【发布时间】:2011-08-26 16:36:07
【问题描述】:
在基于 Magento 的电子商务网站上,我试图从 URL 中删除 index.php,并将非 www 的 301 重定向到 www。
默认网址:www.example.com/index.php/super-cool-product.html
所需产品网址:www.example.com/super-cool-product.html
还有 301 将非 www 重定向到 www:
example.com/super-cool-product.html
到:
www.example.com/super-cool-product.html
还有:
www.example.com/index.html
到:
www.example.com
这是我目前拥有的:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.rejuvahealth.com/$1 [R=301,NC,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.rejuvahealth.com/$1 [R=301,NC,L]
【问题讨论】:
-
你没有说什么是错的,所以我认为你所做的工作是有效的。祝你成功!