1

I have posted another question too which is related, but separate.

Removing old format URLS

This question is slightly confusing because I changed the domain. Previously, we were running the site at www.hartnollguitars.co.uk, this has been changed to www.onlineguitarsales.co.uk (all 301 redirections are in place and I have used the Change Domain tool in Webmaster tools to activate a change of domain request, which is still in progress)

I notice Google still has indexed URLs such as:

  • https://www.hartnollguitars.co.uk/products.aspx?id=1930
  • https://www.hartnollguitars.co.uk/product/?id=1930

The above URLs, are firstly, obviously pointing to the old domain. The 301s and Domain Change Request should overcome that problem, but they both point to the same product and incorrectly to an old version of a URL.

There is a 301 redirect in place to redirect anything to products.aspx? to /product/ but it isn't redirecting to the proper canonical URL which, in this case would be https://www.onlineguitarsales.co.uk/product/soundlab-pedal-power-450-power-bank-6-way-p1930 as per the rel="canonical" tag present in the <head> of the page returned by both of the above links.

Should there be a 301 redirect to the canonical link on all pages with any kind of old format URL, or will the rel="canonical" and domain change request be enough to tell Google to drop the indexing of the old ones and start indexing the specified canonical URLs instead?

6
  • Why does this deserve a downvote? I'm new to this forum and trying to ask legitimate questions Jun 27, 2016 at 12:35
  • 1
    Short answer? It doesn't. I did what I could do to fix it! Cheers!!
    – closetnoc
    Jun 27, 2016 at 14:31
  • How long have these 301 redirects been in place?? If it has been a while, and there is no significant link value to your original domain, then you may want to just drop the 301s and potentially let the original domain go if that is what you want. The reason why these pages still show up in the index is because of the 301. As soon as the 301 is dropped, these SERP links/snippets go away. In otherwords, it may be time to just let your new domain perform on its own.
    – closetnoc
    Jun 27, 2016 at 14:40
  • The domain change has only been in effect for about a month... Jun 27, 2016 at 15:28
  • 1
    A month may not be enough time depending upon how fast/often Google fetches your pages.
    – closetnoc
    Jun 27, 2016 at 15:35

1 Answer 1

1

Should there be a 301 redirect to the canonical link on all pages with any kind of old format URL, or will the rel="canonical" and domain change request be enough to tell Google to drop the indexing of the old ones and start indexing the specified canonical URLs instead?

Google treats rel="canonical" as hints that a page is substantially duplicate to another page. What I recommend is a 301 redirect so that when google does it's next round of crawling your website, it will completely understand what you are trying to do.

As far as your links being incorrect, It seems like you are trying to convert product ID numbers to a product name found in a database and redirecting users to that. In apache, that cannot be done by itself.

What you should do is create a script that takes the id value as the input and looks up the correct data in the database then once its found, produce a redirect to the correct page.

Make it so that this script executes when anyone accesses a URL like example.com/products.aspx?id=whatever

Here's code in PHP to help you get started. I'll explain each line.

<?php
$wantedid=$_GET['id'];
$wantedname=lookupid($wantedid);
header('HTTP/1.1 301 Redirect',true);
header('Location: http://example.com/product/'.urlencode($wantedname),true);
?>

1st line grabs the id value which in your case is a number.

2nd line calls a lookupid function which passes in the number. This function is your own function that looks up the value in a database based on the number.

3rd line overrides the HTTP headers so that the status is now 301 instead of 200.

4th line adds a location header and specifies the new URL. In most browsers this setup is sufficient since auto-redirection happens behind the scenes. You may need to add extra HTML at the end of the PHP code to support browsers without auto-redirection support.

Because this isn't really a forum for programming questions, I won't go into great detail on how to retrieve database values and such, but you got the basics of how to redirect from a number to a value.

4
  • In apache, that cannot be done by itself. mod_perl in Apache can. Cheers!!
    – closetnoc
    Jun 27, 2016 at 14:33
  • That's why I said by "itself". It takes a module to make the magic happen (such as mod_perl). Jun 27, 2016 at 14:35
  • Except that mod_perl is native to Apache and always has been. Plus you can do this in any .conf or .htaccess file.
    – closetnoc
    Jun 27, 2016 at 14:41
  • OK, so basically, the message is "yes" it should have 301s redirecting to the "correct" URL. The URL re-writing to product titles is all there, but these are old URLs which have been indexed from before any "friendly" URLs existed. Jun 27, 2016 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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