Skip to content

Useful htaccess redirect trick for WordPress

Let say you have a page that contains old content. You don’t want to delete the page and cause confusion or bad user experience for your readers. You just want to redirect them to a different post or page. This can be accomplished by installing a plugin or to add some code to your .htaccess file.

Now I would advise you to install a plugin like Yoast SEO to help you with this, but I really want to show you how the code looks like for the .htaccess file.

You will need the FTP details for your WordPress website. You can get it from your hosting provider or if you host with iAdminWP you can only send us an email and we change it for you.

You will find the .htaccess file in your root directory, if you don’t see it then it is hidden. You will need to show all hidden files.

Open it in your code editor or in notepad. You will see something like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Now you want to put the code just above the </IfModule> line.

Redirect 301 /your-old-post/

This is not for everyone, like I said before, install a plugin where you can manage all the redirects of old content. If you have any questions please leave a comment below.


The Next Gen of Managed WordPress Service You deserve more than just a Hosting company! Hosting, Maintenance, Secure, Content updates and Cloud Backups

We are more than just a Hosting company!

AdminWP Host, Maintain (Site-care), Secure and Backup WordPress websites.