0

The link to certain pages on a site I've written looks like this:

http://myhymnal.net/2/be-thou-my-vision

That would be the id and a slug. When I paste this URL into the Facebook post field, the URL it ends up fetching an "example" of is the following:

http://myhymnal.net/2/2/be-thou-my-vision

Could anyone help me figure out where that extra 2/ comes from? I don't understand it.


Findings

  • The URL I paste in is http://myhymnal.net/2/be-thou-my-vision and works fine in the browser.
  • The base href is set to http://myhymnal.net/ and I have set the canonical to 2/be-thou-my-vision, which is relative to the base URL and should work fine. Although I suppose this maybe could be what's messing it up?

Other than that I really have no clue... :(

Svish
  • 152,914
  • 173
  • 462
  • 620

1 Answers1

0

Look at Facebook's Debug Tool - you're setting the canonical URL relative to the current directory, not the site root - facebook is then fetching http://myhymnal.net/2/2/be-thou-my-vision

Use a fully qualified URL for the canonical URL

Igy
  • 43,710
  • 8
  • 89
  • 115
  • But according to Google (i think that's where I read it at least) the canonical URL should be relative to the base url if that has been specified, which it has been. – Svish Apr 12 '13 at 19:45
  • I also don't get why I end up with http://myhymnal.net/2/2/be-thou-my-vision and not for example http://myhymnal.net/2/be-thou-my-vision/2/be-thou-my-vision, it was relative to the directory, which would be 2/be-thou-my-vision. Unless it considers be-thou-my-vision a file... – Svish Apr 12 '13 at 19:46
  • I'll make the canonical URL absolute though and see if that fixes it. Just wanted to wait with the fix for a bit to see if someone saw something else wrong that would've fixed it without doing that :) – Svish Apr 12 '13 at 19:47
  • Yep! That fixed it. So even though various docs claims the canonical can be relative to base url, it's safest to stick with an absolute one. Lesson learned. Thanks for the tip on the Debug Tool! Very helpful. – Svish Apr 12 '13 at 20:12