{"id":44267,"date":"2020-07-16T09:32:08","date_gmt":"2020-07-16T09:32:08","guid":{"rendered":"https:\/\/www.glassmountains.co.uk\/?p=44267"},"modified":"2020-07-16T09:49:05","modified_gmt":"2020-07-16T09:49:05","slug":"redirecting-in-wordpress","status":"publish","type":"post","link":"https:\/\/www.glassmountains.co.uk\/campfire\/redirecting-in-wordpress\/","title":{"rendered":"Redirecting in WordPress"},"content":{"rendered":"

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<\/em>). We typically need to do this if we are removing old, outdated content (perhaps for SEO reasons<\/a>) or maybe we have simply thought of a better<\/em> URL for the page (again, we’d probably do this for SEO reasons).<\/p>\n

An Example<\/h2>\n

Our ‘Pay As You G<\/em>o’ WordPress support page was initially published on the following URL:<\/p>\n

Before: <\/strong>https:\/\/www.glassmountains.co.uk\/pay-as-you-go\/<\/a><\/p>\n

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

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.<\/em><\/p>\n

After: <\/strong>https:\/\/www.glassmountains.co.uk\/pay-as-you-go-wordpress-support<\/strong>\/<\/a><\/p>\n

First things first<\/h2>\n

Firstly let’s recap what I’ve done here: I’ve changed the URL of a published page.<\/p>\n

\"Fig

Fig 1 – editing the URL in WordPress<\/em><\/p><\/div>\n

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<\/strong> and Edit<\/strong> buttons.<\/p>\n

(*if you are using Gutenberg, it will be slightly different; I’ll check and come back and update as necessary).<\/em><\/p>\n

The Permalink<\/strong> 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.<\/p>\n

If you don’t like that URL you can simply click ‘Edit<\/strong>‘ and change it.<\/p>\n

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

However, if you have<\/em> already published your page\/post, then you need to tread carefully. Let’s examine why\u2026<\/p>\n

Google<\/h2>\n

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<\/em> it (i.e. analyse it), and then, where applicable, will integrate your page into relevant search results listings.<\/p>\n

Tip: You can also ask Google to index a particular page; rather than waiting for them.<\/a><\/em><\/p>\n

When Google originally indexed our Pay as You Go<\/strong> page, the listing in the search results looked as below:<\/p>\n

\"Fig

Fig 2 – the original search listing (with old URL)<\/em><\/p><\/div>\n

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

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<\/em> 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.<\/p>\n

To clarify – by ‘break Google<\/em>‘ I mean that the following would happen:<\/p>\n

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

    Why? Because the page no longer exists on that URL, as you’ve changed the permalink!<\/p>\n

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

    How can I avoid this?<\/h2>\n

    To avoid this situation we need to tell Google that we have changed the website URL.<\/p>\n

    This is called ‘putting in place a redirect’<\/em>.<\/p>\n

    To do this you typically need a plugin.<\/p>\n

    One such plugin is Safe Redirect Manager<\/a> (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).<\/p>\n

    Safe Redirect Manager<\/h2>\n

    Once you have installed this plugin, you can access it as follows:<\/p>\n

    \"Fig

    Fig 3 – Safe Redirect Manager<\/p><\/div>\n

     <\/p>\n

    In Fig 3 you can see how to access ‘Safe Redirect Manager’ from the left-hand menu.<\/p>\n

    And when you are in the section, you can then click the [Create Redirect Rule]<\/strong> button at the top. You’ll then see the following page:<\/p>\n

    \"Fig

    Fig 4 – adding a new redirect rule<\/em><\/p><\/div>\n

    When adding a new redirect rule, the key fields are:<\/p>\n