tuyendung242
12-01-2012, 12:30
Chào mọi người, mình có tìm hiểu bề redirect www sang non www cho một trang web là dùng dòng lệnh sau trong .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Mình thấy nó có hiệu quả là đã redirect từ www.example.com -> example.com khi mình type www.example.com.
Vấn đề thắc mắc của mình ở đây là khi mình type www.example.com/ab/cd thì nó redirect về example.com/index.php chứ không về example.com/ab/cd.
Vậy làm sao để khắc phục vấn đề trên ?
Cảm ơn....
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Mình thấy nó có hiệu quả là đã redirect từ www.example.com -> example.com khi mình type www.example.com.
Vấn đề thắc mắc của mình ở đây là khi mình type www.example.com/ab/cd thì nó redirect về example.com/index.php chứ không về example.com/ab/cd.
Vậy làm sao để khắc phục vấn đề trên ?
Cảm ơn....