How to Redirect a Deleted Page to Another Page Using .htaccess file
When you delete a page or a post or a category you will break any links to that web address.
As there is no web page to display, the web server sends a page that simply says “404 Page not found”. 404 errors can have a negative effect on your website’s search ranking and can be frustrating for site users.
The solution to this is to redirect the page to another similar page. There a many ways to do this but the simplest solution is to use .htaccess file.
If you are comfortable editing files, you simply need to add one line of code to your .htaccess file to create a redirect.
Here is the code to add:
redirect 301 /old-page/ http://yoursite.com/new-page
Somethings to note:
- replace /old-page/ with your old page slug. Do not include your domain URL, only the page slug.
- replace http://yoursite.com/new-page/ with the full path including http:// (www is optional) to your new page. Include a trailing slash (/) at the end of your URL
- put each redirect on its own line.