Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to link to domain root?

Tags:

I'm setting up links and not sure which is the best way to link to the domain root should I do

<a href="/">home</a> or <a href="http://example.com">home</a> ?

is there a cooler way that I'm unaware of?

like image 807
JKirchartz Avatar asked Apr 05 '11 14:04

JKirchartz


People also ask

What is linking root domain?

When a site links to another one or more than one time in Search Engine Optimization, site A is said to be a linking root domain; the plural, linking root domains is the total number of separate links that link once or more than once to a given site.

What are linking domains?

What are Linking Domains? Linking Domains are sites that link to your site. The count here is the total number of domains linking to you. If you have ten backlinks from a single domain, like Pinterest or Wikipedia, this will be counted as one linking domain.

What is HTML href?

The href attribute specifies the URL of the page the link goes to. If the href attribute is not present, the <a> tag will not be a hyperlink. Tip: You can use href="#top" or href="#" to link to the top of the current page!


2 Answers

Unless you have a specific reason you want to always use HTTP, use <a href="/">text</a>. You'll run into problems with SSL otherwise.

There is a cooler way to do it if you're loading scripts, and that is to load cross domain scripts in a protocol-neutral way, as such:

<script src="//example-cdn.com/scripts/jquery-latest-min.js"></script>

That way you avoid the HTTP mixed content warnings in IE.

like image 131
Brian Hicks Avatar answered Oct 11 '22 15:10

Brian Hicks


the simpler / variant is portable across domains, might be considered as an advantage.

like image 38
Jan Zyka Avatar answered Oct 11 '22 15:10

Jan Zyka