Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

And 404 to control the redirect page

Published on| April 4th, 2009 | No Comment.

Well, and as more and more articles and categories, and rewrite the menu, you want to change the configuration. In this case, that's the problem, the long-awaited, Google and Yahoo in the top pages of search engines, such as the old URL will still be linked to.
And rewrite the menu, and they made changes such as short, people have to your site from search results, Joomla! That will be available in the standard 404 page. This page is too impressive red screen (standard color), I strongly giving the impression of the error, and sometimes even giving the impression that it is no longer there.
The problem, to eliminate the loose, and redirect 404 pages, more will want to think about changing back to the soft impression. Here, let's think about that.

You can explore STEP.1 Apache redirect
Today, WEB server market share is 50% of Apache's said. Follow the server, IIS is like.
Here, Apache's redirection features (Redirect, RedirectMatch) Let's use.

Apache is,. Htaccess can manage files in a directory.
. htaccess the directory exists, you can control the information that is written in it. Also, every directory under the like. Htaccess, if present, the most recent. Htaccess will override the contents of the.

In fact, in order to redirect,. Htaccess do I write the following file.
Redirect permanent /test/ http://www.sample.com/test2/

In the above description,
This WEB server / test / access that is, http://www.sample.com/test2/ to be redirected to
Means.

If you want to redirect individual pages more, do I describe it as a separate page.
Redirect permanent /test/sample.html http://www.sample.com/test2/sample2.html
If more names are processed飛BASHITAI, RedirectMatch you can use.

RedirectMatch permanent (.*) \. Htm $ http://www.sample.com $ 1.html
This example, all. Htm extension said,. Html conversion means.
Cases)
http://www.sample.com/test/ 1.htm → http://www.sample.com/test/ 1.html

To learn more, you'll see the following pages, you will have more information.
Redirect directives
http://httpd.apache.org/docs-2.2/en/mod/mod_alias.html # redirect

RedirectMatch Directive
http://httpd.apache.org/docs-2.2/en/mod/mod_alias.html # redirectmatch


You can explore STEP.2 Apache Error Documents
Next, 404 the same as using the Apache, another page (Joomla! Of 404 non-standard) Consider a move.
This is, Apache Given the features, I like to do.
ErrorDocument 404 http://www.sample.com/error404.html

This is
404 error (an error page that is specified does not exist) if, http://www.sample.com/error404.html please see the
Apache and that is not specified, the server (Joomla!? ), There may not work.
(※ real cause of the problem? ? ? )
For more details, see the following URL to help, so I have described.
ErrorDocument directive
http://httpd.apache.org/docs/2.2/en/mod/core.html # errordocument

The above method, Joomla! As, in a way that is not original.
http://docs.joomla.org/Tutorial:Advanced_topics Custom error pages for more information.
Joomla! On how to customize the error page is similar to the manner described above.

The next step, Joomla! Template set 404 to move to get your own page.

STEP.3 Joomla! Template set 404 to move to your own page
Next, 404 to Joomla! Using templates, a different page (Joomla! Of 404 non-standard) Consider a move.
This is simple. (Which are presented in various forums page)
  1. error.php file that you created in UTF-8N.
    ※ This, /template/system/error.php most safe is to change the default template directory and copy to their own use.

    What is the contents of the following.
    1
    2
    3
    4
    5
    6
    7
    
    <?php
    	defined( '_JEXEC' ) or die( 'Restricted index access' );
    	if (($this->error->code) == '404') {
    		header('Location:http://www.example.com/error404.html');
    		exit;
    	}
    ?>
    http://www.example.com/ is the name of your site.

  2. 404 pages when you want the errors (HTML) to create, error404.html save.

  3. error.php error404.html and to upload to the server.

    error.php, to the folder you are using a template
    Cases)
    /template/templatenameyouareusing/error.php

    error404.html the root directory of your WEB server
    Cases)
    /error404.html


Finally, the recent bonus, Recently, even if www is not applied to the head of URL or is applied , it can often access the same page. This is for the user, may be good, Google and Yahoo, may be recognized as a separate site.

Here,. Htaccess using, www turning on when you access, to redirect Always, www'll try to describe them.

Joomla! Is set to write to redirect the default rules, is essential to keep the top.

Www typical example if set)
※ RewriteEngine On describing the position directly beneath the original source.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^exmaple\.com$  [NC]
RewriteRule ^(.*)$ http://www.exmaple.com/$1 [R=301,L]
Or even a good description of the following.
※ RewriteEngine On describing the position directly beneath the original source.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.exmaple\.com$ [NC]
RewriteRule ^(.*)$ http://www.exmaple.com/$1 [R=301,L]

In this setting, Google fails to get authorization from the webmaster, please see the following pages.
1
2
3
4
5
6
7
8
<?php
	defined( '_JEXEC' ) or die( 'Restricted index access' );
	if (($this->error->code) == '404') {
		header("HTTP/1.0 404 Not Found");
		header('Location: ' . $this->baseurl . 'error404.html', false ,404);
		exit;
	}
?>

-->

Comments

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ