In terms of SEO, is there a best practice for writing the following relative links:

  • href="./foo"
  • href="foo"

What about href="../../../foo"? Is that "difficult" for a bot to follow?

I see most sites use href="/relative/path/to/domain/root". I'm curious as to why.


I've never seen a crawler or search engine that couldn't handle relative URLs, including the ones with dots in them. For SEO, the dot notation would be just fine. Search engines can follow those links, and assign benefit to them properly.

I stopped using relative directory dots in my links because:

  • It makes it hard to move pages around. It is much easier to move a page to a new directory when all the links are relative to the root (/).
  • Directory dots don't work well in templates that can be included in files that live in multiple directories.
  • Most webservers are configured to serve the same page no matter how many trailing slashes are on the directory. /dir/foo.html and /dir/////foo.html are usually equivelant. However, dot relative links on the latter will be broken.
  • I agree that crawlers at least for the big search engines have no trouble with dot notations. I also agree that likely most browsers do not have problems with dot notations. Where I argue not to use them is that the dot notation has to be filled in and it is easy to make mistakes and foobar a site some kinda royal. It seems that you and I are in agreement on this. I too stopped using them simply for organizational reasons. It is far better for me to fill in the .. blanks and to keep a site organized than to go Huh? down the line. – closetnoc Sep 28 '15 at 19:30
  • Note that in a way the dot notation could help you keep things straight if you move a certain set of sub-folders to a new path... otherwise you'd have to edit all the pages and fix the "more root part" of the path to match the new location. So you have the exact same problem either way. I use Doxygen which creates documentation for my software. It uses relative path everywhere which allows me to place the resulting docs anywhere I want on my website! Now, I when use WordPress I definitely get full paths including the domain name by default. – Alexis Wilke Mar 19 '18 at 1:18

Do not use dots in your links. While it may be perfectly valid, it is not a good idea in general. Some swear by using the full URL/URI (example.com/content/my-content-page.php) over relative URI only (/content/my-content-page.php). I use relative, however, I do see the point in making full references to help with content scraping and may switch somewhere down the line for this reason. Remember, if you use dot notations, something (browser, search engine, whatever) will have to figure this out which may not yield the results you want. It is better to be at least somewhat verbose in your reference to avoid issues down the line.

As far as SEO is concerned, the dots do not add value. While no-one really knows how search engines handle links fully, Google does tell us that they try and resolve all links and URLs so that they are complete. It is not clear if you get semantic credit for links and URLs filled in by Google at all or if semantics is only applied to links where terms are used in the original link. It is clear that the link URL resolver does run as a separate batch process periodically and that by contrast semantics is applied immediately when the link is discovered. It is just not clear if the semantics is updated. For this reason, make the worse assumption you can (to be safe) and assume that the semantic value of your links is based upon the work you do and spell out each link fully.

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.