wordpress-redirect-large

How to create a WordPress redirect

John Pawson's Layout avatar

There may be times that you want to add a redirect within your WordPress website to point your visitors from one URL to another. For example, if you change the permalink structure of your site or remove posts or pages, if someone tries to visit that old link, all they’re likely to find is a “404 page not found” message (which can be customized, but that’s another story!)

Thankfully like many things within WordPress, there are a number of ways to achieve redirects quickly and simply:

Redirect plugins:

There are a number of plugins out there that you can use to take care of redirects. A personal favorite is Quick Page/Post Redirect.

wordpress-redirect-plugin

This plugin lets you do exactly what it says on the tin – redirect pages and posts, quickly.

Once installed, you will find a redirects section in the page/post editor in the back end of WordPress. In here, simply select the type of redirect you would like.The type of redirect you choose will depend on whether the redirect is temporary or permanent – in other words, whether you simply want a redirect for the time being, or you are not planning on switching it back. Your options are:

  • 301 permanent redirect: If the page you are redirecting will always be redirected, more often than not, you’ll want to choose this option, as it informs Google to redirect all traffic to the new page, forever.
  • 302/307 temporary redirect: The opposite of the above. If you plan on turning the redirected page’s URL back on at some point and don’t want Google to redirect all traffic, then you can choose this option.
  • Meta redirect: This redirect actually happens after the initial page has loaded. It adds code to the original page’s source in order to cause the page to redirect after a set period of time. This may be useful if you wanted to add a message to the original page to tell visitors that the page they’re looking for is now at a new address, but otherwise, a 301 or 302 redirect would be sufficient.

Once you’ve chosen your redirect type, simply set where you want the page to redirect to, and mark it as active. When you publish/save the page or post the redirect will be active.

Alternatively, you can add a whole list of redirects in the plugin settings section itself. This allows you to create redirects for pages that perhaps don’t even have an entry in the WordPress CMS, which can be particularly helpful if you have previously moved from a non-WordPress site. You can add redirects to any link relative to your site’s URL; as long as the link begins with your site’s web address, you can add a redirect for it.

wordpress-redirect-computer

.htaccess redirect

If your site is on apache and you have access to your .htaccess file, you can use it to add redirects to your site. If you don’t know what you’re doing with .htaccess files, it might be worth sticking to the plugin method above, as making an error in this critical file can cause some pretty serious site-wide consequences (such as it crashing completely and locking you out of WordPress!)

But for those who like to venture into this file, simply add the following line for each of your redirects:

Redirect 301 /pagetoberedirected.html http://www.yoursite.com/newpage

The first URL is the one that you want to redirect, the second is where you want visitors to land instead.

And that’s it! There’s nothing much to redirects, but redirecting visitors from broken links can improve their user experience and can help with your ranking amongst Google, so it’s definitely worth giving it a go.

Comments ( 0 )

Join the discussion