PHP url rewriting file (. htaccess) brings us great convenience, as long as the following code can achieve non-www 301 jump.
The Code is as follows: |
Copy code |
1. RewriteCond % {HTTP_HOST} ^ bKjia. c0m $ [NC] 2. RewriteRule ^ (. *) $ http://www.bKjia. c0m/$1 [L, R = 301] |
. Htaccess setting 301 method, old domain name to new domain name
Setting method:
The Code is as follows: |
Copy code |
RewriteEngine On RewriteCond % {HTTP_HOST} ^ olddomain.com [NC, OR] RewriteCond % {HTTP_HOST} ^ www.olddomain.com [NC] RewriteRule ^ (. *) $ http://www.newdomain.com/#1 [L, R = 301] |
Second: redirect the domain name to the second-level directory of the new domain name of the website mulu:
Based on the website code:
The Code is as follows: |
Copy code |
RewriteEngine On RewriteCond % {HTTP_HOST} ^ old.com [NC, OR] RewriteCond % {HTTP_HOST} ^ www.old.com [NC] RewriteRule ^ (. *) $ http://www.new.com/mulu/#1 [L, R = 301] |