简体   繁体   中英

RewriteRule after RedirectPermanent adds query string

I'm using this rewrite rule, which works perfectly fine

RewriteRule ^(.*)-S\.html\??(.*)$ /index.php?mod=home&action=stadt&stadt=$1&$2 [QSA]

It points URLs like /Albersdorf-Holst-S.html to their PHP URL args.

Now, I need to rename some of these names, that's why I want to put RedirectPermanents in place. Likt this on for example:

RedirectPermanent /Albersdorf-Holst-S.html http://www.gruppenunterkuenfte.de/Albersdorf-Holstein--S.html

I would expect, when putting the RedirectPermanent in front of the RewriteRule it will be executed first and the RewriteRule will then be applied to the result.

But what happens, is that the URL in the adress bar reads after the redirect:

http://www.gruppenunterkuenfte.de/Albersdorf-Holstein--S.html?mod=home&action=stadt&stadt=Albersdorf-Holst&

Why is the query string added? And why does this only happen, when I redirect first.

使用RewriteRule ... [L,R=301]代替RedirectPermanent帮助:

RewriteRule ^Albersdorf-Holst-S.html http://www.gruppenunterkuenfte.de/Albersdorf-Holstein--S.html [L,R=301]

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