【发布时间】:2014-04-15 16:52:28
【问题描述】:
下面是我们的 .htaccess 文件。所有 301 重定向都可以正常工作。之后在文件中,我们用于重定向的中间 ReWriteRule 都不起作用。 store/locations.php 的第一个重写规则非常简单,应该可以正常工作。
我确实认识到,在那个简单的重写规则之后,所有其他重写规则都包含一个“?”这可能需要我们做一些其他的事情(即逃避“?”)。但我什至无法让重写规则在简单的 url 上工作,所以想知道我们可能做错了什么。
有趣的是,.htaccess 文件底部的重写条件和重写规则确实可以正常工作(将任何非 www url 转换为 www url)。
Redirect 301 /store/index.php http://www.pelleline.com
Redirect 301 /store/contact-us.php http://www.pelleline.com/contact-us.php
Redirect 301 /index.html http://www.pelleline.com
Redirect 301 /index.htm http://www.pelleline.com
Redirect 301 /store/index.html http://www.pelleline.com
Redirect 301 /store/index.htm http://www.pelleline.com
RewriteEngine on
RewriteRule ^store/locations.php?/?$ http://www.pelleline.com/locations.php [L,R=301]
RewriteRule ^store/product-list.php?a_testoni_shoes-pg1-cid46.html?/?$
http://www.pelleline.com/a-testoni-shoes/cid-46-1.html [L,R=301]
RewriteRule ^store/product-list.php?alden_shoes-pg1-cid47.html?/?$
http://www.pelleline.com/alden-shoes/cid-47-1.html [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
【问题讨论】:
标签: php apache .htaccess mod-rewrite redirect