1

I recently learned that the default WP permalink with post date is not SEO friendly. So I had to change the links for all 270 posts on my blog. However, the old links still display on Google search engine for over a week now.

For example, If you search for the term "Kimfly mobile phone specifications and price", this link will appear:

example.com/blog/2017/06/21/kimfly-mobile-phones-specification-price/

with a page not found message. The new link is:

example.com/blog/kimfly-mobile-phones-specification-price/.

How do I get Google to Redirect the old link to the new one until googlebot is able to display the new link in search results.

2

It is a good idea to create 301 redirects for any moved content. This lets visitors, including Google, know that the page has moved and where to find it.

Since your change follows a pattern, you can redirect the URLs with a single rule. The most simply way to do this is by modifying your .htaccess file.

In your document root, where your site's files exist, look for a file named .htaccess. You may have to enable an option to show hidden files, depending on how you are viewing your files. Somewhere near the top, probably above the WordPress block, add a couple of lines of code like this:

RewriteEngine on
RewriteRule ^/blog/([0-9]+/[0-9]+/[0-9]+/)(.+)$ /blog/$2 [R=301]

Assuming that you are using a standard Apache installation, that should cause your old URLs to redirect to the new URLs, so that if somebody visits the old one, their browser will update it to the new one. This assumes that all such pages have the format where the name is "/blog/" followed by three sets of digits delimited by "/", and that the set of numbers is what needs to be removed.

  • 2
    You'll need to remove the slash prefix on the RewriteRule pattern for this to work in .htaccess. You'll also need the L flag to prevent the WordPress front controller from rewritting the URL and creating a mashed redirect. No need for the first capturing group - just need the last one and have only $1 in the substitution. – MrWhite Jul 25 '17 at 20:59
  • I appreciate the help. But this is a bit too complex for me. So I installed the redirection WP plugin as suggested below for the task. – Obruche Aki Jul 27 '17 at 7:10
0

I would recommend that you make a list of all your old urls that you wish to redirect to their new ones. This is not only important to help google find its way but also to keep your old linkjuice coming from backlinks to your website. Otherwise that will be lost and you will loose rankings. After that you should get a redirect plugin for wordpress. No need to manually manipulate your htaccess if you don't feel comfortable doibg that. Theres a plugin called redirection. Look into that one. Then point every single old url to its new url. When that is done and you have verified that it is working you go to Google Search Console and do a fetch and render and then ask google to crawl your entire website. Once that is done you can expect your serp to change faster and you will end up a lot happier :)

  • I have installed the redirection WP plugin @Kristian. The old url are so may but I will try to redirect all of them. Thanks a lot. – Obruche Aki Jul 27 '17 at 7:08
  • Glad to help! Let me know if you need help with that. – Kristian Svensson Jul 27 '17 at 15:52
  • One thing though. I redirected the one of the over 270 old urls to a wrong new url. I then corrected it by removing the wrong url with the correct on. However, the old link is still redirected to the wrong url. Even when I deleted the redirection the old link continues to redirect to the wrong url. I used the redirection WP plugin for all these processes. – Obruche Aki Jul 28 '17 at 19:10
  • It might just be a dns caching issue ocurring in your browser. Try opening an incognito browserwindow or use a different machine or smartphone to test that the new redirect is working. Did that help? – Kristian Svensson Jul 28 '17 at 19:37
  • I don't know what I did but I tried with a different browser by searching for the keyword for that page on google search and found that the link has been updated by google. However this redirect WP plugin surely has some bugs, so I think. I redirected another link and it worked well on all three browsers on my computer but displays 404 on my Tab. I tried with 2 browsers on my tab but still the same problem. – Obruche Aki Jul 29 '17 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.