<base href="http://domainname/">

Discussion in 'HTML & Website Design' started by healer, May 7, 2009.

  1. #1
    I understand when we code web pages we should always refer to another page with the domain name not just a relative path probably because it helps the search engine spider. I have supposed including a <base href="http://domainname/"> in the <head> area should do the job. Having done this I found I couldn't really test the pages locally on our computer. Is it a way to do something like that but we still can test the pages on our local computer before uploading to the web server. For example, can we have the "base href" reference outside the html page so that we can delete or change at one place not every page for local testing.
     
    healer, May 7, 2009 IP
  2. Martin K

    Martin K Active Member

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Hi healer,
    First of all the "base" tag is used when you have "broken" links, so that the browser can show your page typed in the base tag instead of 404 error page or something. There is no need the base tag to be in different file you can type hrefs without the domain name: </code><base href="/404.html"></code>, where 404.html is your error page.

    Martin
     
    Martin K, May 13, 2009 IP
  3. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #3
    Use PHP includes for common areas, put the <base> in there.
     
    rochow, May 13, 2009 IP