Create redirect from url like www.example.us/?p=100&option=

I am switching over CMS and also have concerning 600 URLs that require to get rerouted to the new system. The URL on the old website resembles the adhering to on my examination server:

www.example.us/?p=100&option=com_wordpress&Itemid=619

The new URL system will certainly exist as:

www.example.us/blog.php?p=100

Some old URLs make use of p =, others id = or catid =. I have actually attempted numerous redirects like the adhering to, all falling short for numerous reasons:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI}  ^/$
RewriteCond %{QUERY_STRING} ^p=100
RewriteRule .* 100.php

The outcome is that it reroute to 100.php yet adds the question string to the link and also winds up like:

example.us/100.php?p=100&option=com_wordpress&Itemid=619

That is the closest to a remedy. I have actually additionally attempted the adhering to with the failing message kept in mind below:

RewriteCond %{REQUEST_URI}  ^/$
RewriteCond %{QUERY_STRING} ^p=100
RewriteRule ^(.*)$ 100.php
# Fails as it appends query string

RewriteCond %{REQUEST_URI}  ^/$
RewriteCond %{QUERY_STRING} ^p=100
RewriteRule .* 100.php$
# Fails with The requested URL /100.php$ was not found on this server.

RewriteEngine on
RewriteCond %{QUERY_STRING} ^p=100$
RewriteRule ^index\.php$ 100.php [L,R=301]
# Fails redirecting to /index.html

RewriteRule p=100 100.php  [R=301,L]
# Fails redirecting to /index.html

RewriteRule ^p=100$ 100.php  [R=301,L]
# Fails redirecting to /index.html

I attempted most of the above with/without http:// coming before the redirect to URL.

5
2022-07-25 20:40:16
Source Share
Answers: 0