[英]Ignored mod_rewrite instructions in .htaccess (WordPress)
We've changed the permalink structure for our WordPress blog (bad idea, I know). 我们已经更改了WordPress博客的永久链接结构(我知道这个主意不好)。 I tried to avoid 404s from external links with mod_rewrite instructions in the .htaccess of the base folder of the WordPress installation:
我试图通过WordPress安装基本文件夹的.htaccess中的mod_rewrite指令来避免来自外部链接的404:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^\d\d\d\d\-\d\d\-\d\d_(.+)$ $1 [L]
# other rewrites
</IfModule>
I tried a few variations on that, even testing the full URL of one page, but the line keeps being ignored. 我对此进行了一些尝试,甚至测试了一页的完整URL,但该行一直被忽略。 But mod_rewrite is running - some other rewrites like
但是mod_rewrite正在运行-其他一些类似的重写
RewriteRule ^seiten/abo\.php[5]?$ subscribe.php5 [R=301,L]
work perfectly. 完美地工作。 I'm stuck.
我被卡住了。 Can anybody help?
有人可以帮忙吗?
Try forcing a 301 redirect by adding R=301
flag in the square brackets: 尝试通过在方括号中添加
R=301
标志来强制执行301重定向:
RewriteRule ^\d\d\d\d\-\d\d\-\d\d_(.+)$ $1 [L,R=301]
This will make it so other rewrites won't (after the first rewrite iteration) modify the URI. 这样一来,其他重写就不会(在第一次重写迭代之后)修改URI。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.