1

My site has webpage urls that use the following format:

www.mysite.com/id/pretty_title

The front page links to these pages, but the href actually contains some parameters:

 www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from

This then redirects to

www.mysite.com/id/pretty_title

which shows the page.

My issue is that Google's search results show the link to the page as the ugly one instead of the pretty redirected one. Besides looking ugly, it can cause errors because the parameters that are included in the ugly link are irrelevant to a user who directly enters a page from Google.

Can I get Google to only use the final redirect url? Or otherwise avoid this issue? I do need to pass these parameters along. Storing info in the session won't work because a user can have several tabs open.

user984003
  • 28,050
  • 64
  • 189
  • 285

1 Answers1

1

On the "ugly URL page" you put <link rel="canonical" href="www.mysite.com/id/pretty_title"> which tells the search engine your preferred URL for that content.

Can also set www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from to have a 301 redirect to your pretty URL

Canonical URLs: https://support.google.com/webmasters/answer/139066

301 Redirects: https://support.google.com/webmasters/answer/93633?hl=en

bakkal
  • 54,350
  • 12
  • 131
  • 107
  • The "ugly url page" never actually exists, at least not where I can just write in this info. The redirect is done internally via Django's HttpResponseRedirect(pretty_url). So I guess I need to figure out how Django can add canonical urls. Thanks! – user984003 Mar 29 '14 at 08:14
  • Ok, so what I have now learned that the "ugly URL page" is the same as the "pretty url page" since it redirects there, so that is where I put the canonical url. Thanks. – user984003 Mar 29 '14 at 08:40