出于规范化的原因,我试图确保 url 前面总是有 www。
不幸的是,当我输入以下网址时:
http://website.net/handbags/1/12/this-is-some-text
它把我重定向到这里:
http://www.website.net/?controller=handbags&path=1/12/this-is-some-text
我想添加它在使用时可以正常工作:
http://www.website.net/handbags/1/12/this-is-some-text
我希望它把我重定向到这里...
http://www.website.net/handbags/1/12/this-is-some-text
我不确定是什么导致了这个错误。这是我的 .htaccess 文件:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# CORE REDIRECT
RewriteRule ^([a-zA-Z]*)/?(.*)?$ index.php?controller=$1&path=$2 [NC,L]
# ENSURE WWW
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+\.[a-z]{2,6})$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
</IfModule>