โดย coquilla18 » 02/10/2014 5:55 pm
Modify .htaccess file
www to non-www redirect
โค้ด: เลือกทั้งหมด
RewriteEngine On
RewriteCond %{HTTP_HOST} www.yoursite.com
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
non-www to www redirect
โค้ด: เลือกทั้งหมด
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
Some Code could be use without specifying your domain name
โค้ด: เลือกทั้งหมด
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,QSA]
Modify .htaccess file
www to non-www redirect
[code]RewriteEngine On
RewriteCond %{HTTP_HOST} www.yoursite.com
RewriteRule (.*) http://yoursite.com/$1 [R=301,L][/code]
non-www to www redirect
[code]RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301][/code]
Some Code could be use without specifying your domain name
[code]RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,QSA][/code]