3

This is not about redirecting /index.php?id=6252 to /category-name.

It's about redirecting:

/category-name?ref=blabla&something=useless-stuff
/category-name?
/category-name????????

to:

/category-name

in a small website that does not use GET methods at all.


I have never seen this technique used (or discussed) anywhere, even Google allows you to visit:

https://www.google.com/????? (PR=0)

instead of:

https://www.google.com/ (PR=9)

I don't like adding extra HTML tags (i.e. canonical) or HTTP headers to my website, so I thought why not this?

My biggest fears though is that search engines wouldn't appreciate it.


I just came to this question but it doesn't add much, I'm not planning to share URLs with extra parameters: Google adds useless parameters to my URL


Update: I'm starting to believe there's nothing wrong with this technique.

Videos from Matt Cutts:

And an image picked from a moz article (look at that ?ref=123 example!):

Canonical URL Tag 301

2
  • From the comments on the image ("IT'S SIMILAR TO A 301"), suggests a rel="canonical", rather than a redirect?
    – MrWhite
    Commented Jul 31, 2013 at 22:31
  • It's just saying that canonical is easier for the dev staff to implement, from what I understood.
    – heytools
    Commented Jul 31, 2013 at 23:33

4 Answers 4

3

Firstly, you should try and avoid those parameters wherever possible. Don't link to these types of URL yourself. Of course it's often outside your control.

If there are certain parameters in the URLs, for example a "ref" parameter that came from a known source (like some advertising or tracking you did) it can be beneficial to redirect to the canonical page.

However, I would not bother trying to catch every single variation of URL parameters like multiple question marks. Just make sure to use rel=canonical and the search engines will know the correct page. Avoiding redirects will also be a little faster for users and provide a better experience.

6
  • Actually it's not that hard to program, splitting/exploding and taking the first part would do (I already have it implemented), should I really provide a better experience (=minus 1 redirection) to people/bots who mess with the URL? hmmm. (+1 for the best answer so far)
    – heytools
    Commented Jul 31, 2013 at 20:11
  • After watching this video youtube.com/watch?v=gJK5Uloy76g I think Google will like the redirection I'm suggesting, or wouldn't hate it at least.
    – heytools
    Commented Jul 31, 2013 at 20:22
  • There is certainly no harm in redirecting in this case (jsperf.com does it), however, I would question whether it was necessary (it is more work, not just for you, but also the server). A rel="canonical" would seem to be the perfect solution to handle the canonicalisation of the querystring IMO. Why would you choose to redirect when the correct page is already served?
    – MrWhite
    Commented Jul 31, 2013 at 22:48
  • In your case, it is clear-cut, you don't have a querystring on any URL so you can simply redirect. However, when you do have a querystring, then redirecting on invalid params is more work (jsperf.com does not bother on the search page for instance - I think this would also slow it down). And it is not always correct to redirect to the canonical URL. These may be factors in explaining why you don't often see it in the wild. Also, what happens with /category-name/useless-stuff?
    – MrWhite
    Commented Jul 31, 2013 at 23:02
  • Why wouldn't I redirect duplicate content to the page that I want to get the traffic to... I consider that visiting "?" pages in a website that doesn't link to them odd, that's why I would prefer redirecting these minor cases than adding a tag to the 99.9% other cases. Even if I don't redirect I would leave canonical tags to when there's a probability to make mistakes, all my links both on website and sitemap are "?"less so I would hardly need canonical. Good to see the jsperf example. category-name/inexistent-page would just return 404 with the custom 404 page, isn't it best?
    – heytools
    Commented Jul 31, 2013 at 23:28
2

Google recommends that you trim unnecessary query parameters from your URLs whenever possible. Overuse of query parameters can cause some of your content to not be indexed, or for you to suffer the duplicate content penalty.

On a related note, if you haven't done so already, read Google's SEO Starter Guide which addresses this and many other SEO issues.

3
  • 2
    This doesn't appear to answer the question. These query parameters would seem to be added by external sites/bots linking to the site in question. The site has no control over these.
    – MrWhite
    Commented Jul 31, 2013 at 9:20
  • 1
    You should strip these out whether you generated them or not, especially if they are not actually valid for the application. Commented Jul 31, 2013 at 9:26
  • @ w3d well said @ Michael you mean I should redirect them? I never seen any website that does it (e.g. Google in the example above)
    – heytools
    Commented Jul 31, 2013 at 19:38
1

If a URL points to a non existing page, the correct thing to do is send a 404 status code and serve up up a useful 404 page for your users.

3
  • 1
    Sorry but how's that related to the question? I did not fail to create a nice 404 page for non existing pages. If I was you I would remove my answer before they start downvoting it.
    – heytools
    Commented Jul 31, 2013 at 2:44
  • What's on the actual address of these pages with extra parameters?
    – Max
    Commented Jul 31, 2013 at 3:43
  • They originally have the same content as URLs without parameters, already mentioned in "website that does not use GET methods at all", I chose to redirect them to ?less pages.
    – heytools
    Commented Jul 31, 2013 at 3:49
1

I think you can use the Webmaster Tools parameter handling function here and not worry too much about 301 interception. Or, if you can, instigate an absolute URL, case sensitive canonical tag and don't worry too much about redirecting rogue query strings as you may require in the future i) detailed analytics tagging, b) advertising / PPC and c) may have internal links with querystring. Don't worry too much about it - your time is much better spent on making a great page & content which would convert a customer

Your Answer

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

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