【发布时间】:2017-01-29 01:14:33
【问题描述】:
这让我很沮丧,我找不到同样的问题,也许我只是搜索错了。有人搞砸了,我们有一堆指向不存在的子文件夹的 Google 链接。所以我试图在 htaccess 中做一个 301 重定向来解决这个问题。
问题是我似乎无法让重定向工作超过一个文件夹。
示例。 http://example.com/subfolder/someOtherFolder 重定向到 http://example.com/someOtherFolder 就好了。
但是http://example.com/subfolder/someOtherFolder/yetAnother 停留在同一页面上并返回 404。
这是我的整个 .htaccess 的最后一个变体,它返回上述结果,除了上述结果之外,我没有尝试过返回任何内容。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^sitefiles/(.*)/$ /$1 [R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
帮助? (我讨厌 .htaccess >.
【问题讨论】:
标签: apache .htaccess redirect mod-rewrite