简体   繁体   中英

Ignored mod_rewrite instructions in .htaccess (WordPress)

We've changed the permalink structure for our WordPress blog (bad idea, I know). I tried to avoid 404s from external links with mod_rewrite instructions in the .htaccess of the base folder of the WordPress installation:

<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. But mod_rewrite is running - some other rewrites like

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM