【发布时间】:2014-10-16 19:12:57
【问题描述】:
如何正确地从 www 重定向到非 www url?
我使用这行:
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
但它们效果不佳。他们在地址中添加了andex.php并删除了第一个由/ /四舍五入的exp。
http://www.payamkadeh.com/profile/show/behtateam -> http://payamkadeh.com/index.php/show/behtateam
我的完整 htaccess:
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
#RewriteBase /
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect yii