In January May, a large number of links were invalid due to the revision of a website. google pr was updated at the end of May. The PR of this website was directly reduced from 3 to 2, the indexing also declined sharply. It can be said that the significant revision of the website was the main factor that led to the decrease in PR, and the conclusion was also verified in the GOOGLE website management background, so we quickly used JAVASCRIPT to perform 404 redirection. From the actual test results, GOOGLE also supports 404 redirection and does not punish the website's weight. However, according to IIS log analysis, I feel that BAIDU spider seems indifferent to 404 redirection, so recently I simply reset 301 redirection for the original invalid link.
1. IIS 301 redirection settings
This setting of IIS redirection makes it easier. The following describes the IIS redirection method. Because the website revision is for directory migration, you have to understand the following Microsoft IIS targeting parameters:
We can use URL with parameters when setting URL redirection, because after all, there are a lot of URLs that we often face. If we have one or two pages, 301 redirection can be done in any way.
Parameter 1: $ S -- transfer the URL suffix to the new URL;
Parameter 2: $ P -- pass the query parameter in the URL to the new URL, excluding the question mark (?)
Parameter 3: $ Q -- pass the query parameter in the URL to the new URL, including question mark (?),, Therefore, when setting a URL address, do not include question marks. For example:
Will http://www.jb51.net/catalog.asp? Cate = OS & page = 1, redirection to http://www.jb51.net/category.php? Cate = 1 & page = 1
You only need to set the catelog. asp File Settings in IIS to redirect to category. php $ Q.
Parameter 4: $ V -- specifies the URL of the request, but does not include the server name or any parameter.
Wildcard redirection is also used.
Because we redirect multiple directories, it will be very difficult to set up IIS if different targeted files are set separately, but if all files are directed to one file and then redirected, in addition, because $ _ SERVER ['HTTP _ referer'] cannot obtain the reference page and the result is null, the above parameters must be used for transmission, at this time, you only need to add a parameter to solve the problem of transferring the reference page, such as/301.php? Go = $ V. In this way, you can directly perform URL 301 redirection and redirect in the PHP file.
Example:Copy codeThe Code is as follows: <? Php
$ Url = substr ($ _ GET ['Go'], 1); // remove the front slash
$ E = explode ('/', $ url); // split the string
// Determine and set a new URL
$ Newurl = 'HTTP: // www.jb51.net ';
Header ("HTTP/1.1 301 Moved Permanently ");
Header ("Location:". $ newurl );
?>
Ii. APACHE 301 redirection
The above processing is for IIS. If the server uses APACHE, it is much simpler than IIS redirection, and only needs to be modified. htaccess file, which can be targeted separately. Of course, the htaccess file also supports regular expressions and can be used according to the actual situation.
Directory redirection example:Copy codeThe Code is as follows: <Files ~ "^. (Htaccess | htpasswd) $">
Deny from all
</Files>
Options Indexes
ErrorDocument 404/index.html
DirectoryIndex index.html default.html index. php index.htm default.htm
Redirect permanent/abc/http://www.jb51.net/
Redirect permanent/cde/http://www.jb51.net/
Redirect permanent/fgh/http://www.jb51.net/
Order deny, allow
In this way, APACHE 301 can be permanently redirected.
Example of Full-site 301 redirection:Copy codeThe Code is as follows: Options + FollowSymLinks
RewriteEngine on
RewriteCond % {HTTP_HOST} ^ abc.com [NC]
RewriteRule ^ (. *) $ http://www.jb51.net/#1 [L, R = 301]
Note: After completing the 301 redirection settings, you must test whether the 301 status code is returned correctly. A test address is provided:
Http://www.seoconsultants.com/tools/headers.asp
After entering the test URL, the above URL will automatically jump to the test result location and instantly view the return status code on the page, which is very convenient.