301 steering code collection

1, IIS, set 301 under

Internet Information Service Manager -> virtual directory -> redirects to URL, enters the desired destination URL, and selects a permanent redirection of the resource".

2, ASP’s 301 turn code

3, ASP.Net’s 301 turn code

4, PHP’s 301 turn code

header ("HTTP/1.1 301, Moved, Permanently");

header ("Location: http://s.www.zzxiu.com/articles/301/");

, exit ();

5, CGI Perl under the 301 steering code

$q = new CGI;

, print, $q-> redirect ("http://s.www.new-url.com/");

6, JSP’s 301 turn code

7, Apache, 301 turn code

new.Htaccess file, enter the following (you need to open mod_rewrite):

1) turn the domain without WWW to the domain name with WWW,

Options +FollowSymLinks

RewriteEngine on

, RewriteCond,%{HTTP_HOST}, ^zzxiu.com, [NC]

^ RewriteRule (. *) $http://s.www.zzxiu.com/$1 [L, R=301]

2) redirected to new domain name

Options +FollowSymLinks

RewriteEngine on

^ RewriteRule (. *) $http://s.www.zzxiu.com/$1 [L, R=301]

3) uses regular 301 turns to implement pseudo static

Options +FollowSymLinks

>

Leave a Reply

Your email address will not be published. Required fields are marked *