Redirect deleted directory/file to a new location using .htaccess

1.4k Views Asked by At

How can I modify my .htaccess to direct users attempting to view old page URLs on our website to the new version? For example:

Old non-functioning URL: www.mysite.com/128

New URL: www.mysite.com/this-is-the-new-location/321

I would like www.mysite.com/128 to show the new page content.

1

There are 1 best solutions below

0
On

This would be it

//301 Redirect Old File
Redirect 301 www.mysite.com/128 www.mysite.com/this-is-the-new-location/321

//301 Redirect Entire Directory
RedirectMatch 301 www.mysite.com/128(.*) www.mysite.com/this-is-the-new-location/321/$1