Redirect from old to new page based on id htaccess apache rules

 

First thing lets take this scenario after changing the permalinks inside a certain client website, old links went to 404 not found page, here is the use case:

www.sveriges-verklighet.se/archives/3135

it should be redirected to the following:

www.sveriges-verklighet.se/?p=3135

 

we should write a Rewrite Rule and Link it with a condition

Then we have to activate this condition with a RULE

 

You can test this use case on https://htaccess.madewithlove.be/

Then navigate to your htaccess file in your cpanel or if you are using greenbackend.com go to the File Manager and edit your wordpress htaccess file to the following

 

Boom, You’ve cruch it!

Thanks for reading this

-Ahmad Naser