Search code examples
htmlnavigationno-www

HTML Navigation Error. How to handle www.website.com versus website.com? Correct navigation in html?


I have the following html code:

<div id="page">
    <a class="topNavigationLink" href="http://MyOwnWebsite.com/">Home</a>
    <a class="topNavigationLink" href="page1.html">page1</a>
    <a class="topNavigationLink" href="page2.html">page2</a>
</div>

When i browse to www.MyOwnWebsite.com and then click on the navigation links, all works as expected.

But if i browse to MYOWnWebsite.com (no www) and then try to navigate to one of the pages i recieve a error :

Firefox can't find the file at http://MyOWnWebsite.com/page1.html.

Am i doing something wrong? what is the correct way to handle www.website.com versus website.com?


Solution

  • To fix this i did the following:

    Went into my host gator control panel -> Clicked on domain redirect. added a permanent redirect from http://website.com to redirect to https://www.mysite.com.

    This way every time the user goes mysite.com without the www , it will redirect them to the www.mysite.com and all the navigation will work from there.