All of my RedirectPermanent rules add a query string to the URL. That unwanted query match the redirected rough URL redefine by RewriteRule as followed :
RewriteRule ^page-([0-9]+)-(.*)$ index.php?page=page&id=$1 [L] This rule works just fine to create that kind of URL :
https://example.com/page-320-enfants The 301 redirections are defined as followed :
RedirectPermanent /page-320-enfants /page-2028-pour-les-invitees Problem : this adds a query string to the newly created url :
https://example.com/page-2028-pour-les-invitees?page=page&id=320 I tried to use RewriteRule (old URL to new URL) instead of RedirectPermanent as recommanded in old questions but it has the exact same effect.
Am I missing something?
UPDATE :
As adviced, I tried to use RewriteRule placed before the common rule itself :
Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] # Redirect Permanent # RewriteRule ^page-2028-pour-les-invitees$ page-320-enfants [R=301,L] # Common rules # ... RewriteRule ^page-([0-9]+)-(.*)$ index.php?page=page&id=$1 [L] ... This attempt does not trigger at all. Could the problem be in the syntax ?
RedirectPermanentrule will add the query string from the earlier rewrite. "I tried to use RewriteRule (old url to new url) instead of RedirectPermanent as recommanded in old questions but it has the exact same effect." - That sounds like you are seeing a cached response from the earlierRedirectPermanent(301s are cached persistently by the browser). If the correctRewriteRuleis placed before the above rewrite it would work as intended. If you placed it after then it wouldn't do anything since the URL-path will not match.