.htaccess - 在文件中的某个点无效后重定向

时间:2012-12-02 10:54:20

标签: .htaccess redirect http-status-code-301

如果有人可以帮助我,我将非常感激...我已经在我的个人商业网站上使用.htaccess 301重定向文件一段时间了但是在文件中的某个点之后,重定向只是不起作用(在Rex Swain的http标头工具中返回200)。

我用精美的牙齿梳理了文件,重定向停止工作的地方根本没有问题(例如,urs就是它们应该是的)。真的不知道为什么他们会在某一点之后停止重定向?

有没有人有任何想法/建议?对于任何愿意提供帮助的人,我都可以发送文件。

期待收到你的回复, 杂色

这是代码,最后一行是不起作用的重定向。在这项工作之前完全没问题。在最后一个之后还有其他重定向(我们只是没有显示它们),它们也没有重定向。文件末尾还有一个空行。

的.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{http_host} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain/$1 [L,R=301]

Options +FollowSymLinks
RewriteEngine on
# index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

重定向示例

Redirect 301 /spas/alexander-house/overnight-packages http://www.domain/spas/alexander-house/spa-breaks

Redirect 301 /spas/alexander-house/day-packages http://www.domain/spas/alexander-house/spa-days

Redirect 301 /spas/alexander-house/weekend-packages http://www.domain/spas/alexander-house/spa-weekends

Redirect 301 /spas/armathwaite-hall/overnight-packages http://www.domain/spas/armathwaite-hall/spa-breaks

Redirect 301 /spas/armathwaite-hall/day-packages.html http://www.domain/spas/armathwaite-hall/spa-days

Redirect 301 /spas/armathwaite-hall/weekend-packages http://www.domain/spas/armathwaite-hall/spa-weekends

Redirect 301 /spas/billesley-manor/overnight-packages http://www.domain/spas/billesley-manor/spa-breaks

Redirect 301 /spas/billesley-manor/day-packages http://www.domain/spas/billesley-manor/spa-days

Redirect 301 /spas/billesley-manor/weekend-packages http://www.domain/spas/billesley-manor/spa-weekends

Redirect 301 /spas/bishopstrow-house/overnight-packages http://www.domain/spas/bishopstrow-house/spa-breaks

Redirect 301 /spas/bishopstrow-house/day-packages http://www.domain/spas/bishopstrow-house/spa-days

Redirect 301 /spas/bishopstrow-house/weekend-packages http://www.domain/spas/bishopstrow-house/spa-weekends

Redirect 301 /spas/bovey-castle/overnight-packages http://www.domain/spas/bovey-castle/spa-breaks

Redirect 301 /spas/bovey-castle/day-packages http://www.domain/spas/bovey-castle/spa-days

Redirect 301 /spas/bovey-castle/weekend-packages http://www.domain/spas/bovey-castle/spa-weekends

Redirect 301 /spas/castlemartyr/overnight-packages http://www.domain/spas/castlemartyr/spa-breaks

Redirect 301 /spas/castlemartyr/day-packages http://www.domain/spas/castlemartyr/spa-days

Redirect 301 /spas/castlemartyr/weekend-packages http://www.domain/spas/castlemartyr/spa-weekends

Redirect 301 /spas/celtic-manor/overnight-packages http://www.domain/spas/celtic-manor/spa-breaks

Redirect 301 /spas/celtic-manor/day-packages http://www.domain/spas/celtic-manor/spa-days

Redirect 301 /spas/celtic-manor/weekend-packages http://www.domain/spas/celtic-manor/spa-weekends

Redirect 301 /spas/chewton-glen/overnight-packages http://www.domain/spas/chewton-glen/spa-breaks

1 个答案:

答案 0 :(得分:0)

您是否尝试将重定向移动到.htaccess文件中的其他行?如果在重定向301 / spas / chewton-glen / overnight-packages http://www.domain/spas/chewton-glen/spa-breaks的新行位置之后的重定向现在不起作用,那么您知道仅此重定向会导致问题。您是否尝试删除此重定向并查看前面的重定向现在是否有效?我打赌它与chewton-glen目录有关?