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:

it should be redirected to the following:


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

Then navigate to your htaccess file in your cpanel or if you are using 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