I have an old webseite made with php and all URLs have the same schema
domain.de/index.php?<sitename>
The first URL parameter is the sitename.
Now I want to redirect some of those URLs, how would a correct redirection look like that redirects only one of these pages and not all of them
Thanks in advance.
I tried this:
Redirect 301 /index.php?impressum /impressum
Example:
Old URL: /index.php?oldurl
New URL: /newurlWithCompletlyDifferentURLName
Update:
# BEGIN WordPress
# Die Anweisungen (Zeilen) zwischen „BEGIN WordPress“ und „END WordPress“ sind
# dynamisch generiert und sollten nur über WordPress-Filter geändert werden.
# Alle Änderungen an den Anweisungen zwischen diesen Markierungen werden überschrieben.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{THE_REQUEST} s/+index.php?impressum1s [NC]
RewriteRule ^ /impressum? [R=301,L]
2
Answers
Full .htaccess:
Earlier Answer:
This may work for you in your site root .htaccess:
Please understand that
Redirect
directive doesn’t support regex and it just matched starting URI. It cannot match query string.Could you please try following, written and tested with shown samples. Please make sure you clear your browser cache before testing your URLs.