Redirecting in WordPress

Redirecting in WordPress

Sometimes with our WordPress sites, we need to either delete pages (or posts), or change their URL (i.e. their unique page address – sometimes referred to as a permalink). We typically need to do this if we are removing old, outdated content (perhaps for SEO reasons) or maybe we have simply thought of a better URL for the page (again, we’d probably do this for SEO reasons).

An Example

Our ‘Pay As You Go’ WordPress support page was initially published on the following URL:

Before: https://www.glassmountains.co.uk/pay-as-you-go/

However, after a while, I realised we had missed an opportunity here by not including keywords such as ‘wordpress support‘ in the URL as this would have a potential advantage in terms of SEO.

Note: To be clear, I would generally NOT recommend stuffing keywords in a URL just for the sake of it, but I would argue that ‘Pay as you go WordPress Support’ actually scans better to humans as well as potentially being more useful in terms of SEO.

After: https://www.glassmountains.co.uk/pay-as-you-go-wordpress-support/

First things first

Firstly let’s recap what I’ve done here: I’ve changed the URL of a published page.

Fig 1 - editing the URL in WordPress

Fig 1 – editing the URL in WordPress

In Fig 1 we are seeing the very top of the backend editor in WordPress when you are editing a Post or a Page*, pay particular attention to the Permalink and Edit buttons.

(*if you are using Gutenberg, it will be slightly different; I’ll check and come back and update as necessary).

The Permalink is the address of your web page (it’s another way of saying URL). In this case, we are seeing the address of this post that you are reading.

If you don’t like that URL you can simply click ‘Edit‘ and change it.

Now, if you have not yet published your post (i.e. it is still in draft mode) then you can edit this permalink and change it willy nilly.

However, if you have already published your page/post, then you need to tread carefully. Let’s examine why…

Google

When we publish on our website, it doesn’t take long for Google and other search engines to discover that new content. When new content is discovered, search engines will index it (i.e. analyse it), and then, where applicable, will integrate your page into relevant search results listings.

Tip: You can also ask Google to index a particular page; rather than waiting for them.

When Google originally indexed our Pay as You Go page, the listing in the search results looked as below:

Fig 2 - the original search listing (with old URL)

Fig 2 – the original search listing (with old URL)

The key point in Fig 2 is that you are seeing the old /pay-as-you-go/ URL.

Now, if I were to have simply edited the permalink and changed that page address to /pay-as-you-go-wordpress-support/, then this would break Google – because Google has no way of instantaneously knowing that you happen to have changed the URL to your page, and that they should then update their listing.

To clarify – by ‘break Google‘ I mean that the following would happen:

  1. Someone may find my pay as you go search results listing in Google (e.g. as per Fig 2)
  2. ……they would click the link (and the Google listing will still think the link is /pay-as-you-go/ but no, I’ve changed it!)
  3. ……they would be taken to my website where they would see a 404 page.

Why? Because the page no longer exists on that URL, as you’ve changed the permalink!

What we are describing here is what is generally called ‘broken links‘ and this is a horrible experience for users, and it can be horrible in terms of SEO.

How can I avoid this?

To avoid this situation we need to tell Google that we have changed the website URL.

This is called ‘putting in place a redirect’.

To do this you typically need a plugin.

One such plugin is Safe Redirect Manager (we used to recommend 301 Simple Redirects but as that plugin does not seem to have been updated for a while and the fact that we’ve had issues with it, we no longer recommend it).

Safe Redirect Manager

Once you have installed this plugin, you can access it as follows:

Fig 3 - Safe Redirect Manager

Fig 3 – Safe Redirect Manager

 

In Fig 3 you can see how to access ‘Safe Redirect Manager’ from the left-hand menu.

And when you are in the section, you can then click the [Create Redirect Rule] button at the top. You’ll then see the following page:

Fig 4 - adding a new redirect rule

Fig 4 – adding a new redirect rule

When adding a new redirect rule, the key fields are:

  • Redirect From
    This is the path of the page you are redirecting from
  • Redirect To
    This is the path of the page you are redirecting to
  • HTTP Status Code
    This is the type of redirect (you’ll typically only use the one I mention down below)

Let’s now fill those fields based on our ‘pay as you go‘ example:

Fig 5 - the /pay-as-you-go/ redirect rules

Fig 5 – the /pay-as-you-go/ redirect rules

 

Notice with Redirect From and Redirect To you need to put the path in. The path is just the bit after your domain name (include the slashes “/”).

If you have permanently changed your URL, then HTTP Status Code will need to be set to ‘301 Moved Permanently‘ (perhaps I’ll mention other use cases in a future post but for 99% of the time, you’ll need to use this HTTP Status Code).

After that, just click [UPDATE] to save your changes and make your redirect live.

You should also now test your redirect to make sure it all works: i.e. try putting the old URL in the browser and you should see it click over to your new URL. If it does not, you may need to go back and re-check your steps.

Update

So it was a few weeks ago that we changed the URL for our ‘pay as you go’ page and put the redirect in place; as you see from the screenshot below, Google has now noticed the change and have updated their SERPS listing accordingly.

Example SERPS listing

The End

Hopefully that helps – if you have any comments or questions, feel free to jump over to our free Facebook Group (where we also run a regular Facebook Live events.

Credit: the photo used in the featured image is by ED259.

Tags: , ,
No Comments

Leave a Reply