Hide filename in URL

Discussion in 'Web Design' started by AusQB, Mar 11, 2009.

to remove all ads.
  1. AusQB

    AusQB New Member

    Messages:
    167
    I see a lot of sites, including this one, that doesn't show filenames in the URL (eg. http://www.domain.com/index.htm).

    How is this done?

    For other pages/subpages, are they simply in subdirectories in the websites file structure?


    EDIT: I tried putting the files in separate folders and renaming them all to index.html, but when I previewed it in Firefox it went to a file system view when trying to access the lower index.html files.


    EDIT: I've been fooling around with how the links are meant to work, and running into a lot of problems regarding relative addresses. If I want one of the nav buttons to link to a subfolder, let's call it "child/", then if I want to jump to another folder from there it will simply concatenate to the end of that path (ie. child/home/).

    How am I meant to create relative addresses in this case? Do I need a script that keeps track of the folder structure and modifies the address accordingly? (ie. change sister/ to ../sister when in the child/ folder)
     
    Last edited: Mar 11, 2009
  2. conor

    conor New Member

    Messages:
    348
    relative addresses need the forward slash before such as '/path/to/file'. They can be used to include files from the root directory. If you are interested in micro-optimization then you will find that relative links perform slower than normal ones but that's just being picky! :)

    Anyway the way this is done is through using a module called ModRewrite. This only works on Linux servers but there are costly Windows equivilants. Basically with mod_rewrite you can tell the server that when someone enters 'http://domain.com/Home' that they are really looking for 'http://domain.com/home.html'.

    It is very interesting to use and there's much more you can do that just URL rewriting!
     
  3. craftygeek

    craftygeek New Member

    Messages:
    77
    Its also known as htaccess due to the .htaccess file that you create in order to set up URL rewrites.

    htaccess is a pretty complex beast - I found a great article to get started with a while back:
    htaccess how to
     
  4. jenni1420

    jenni1420 New Member

    Messages:
    4

    you know all index.htm or index.php or index.xxx files dosen't show in ulrs but another files not.

    all the url that include slash for example 'www.me.com/one' have folder with that name after / in example one and if you have an index.xxx on that folder nothing displaied like http://www.domain.com/hosting/

    if you have problem in relative addresing I can help you too.
     
  5. anna

    anna New Member

    Messages:
    542
    @Larry

    Podcast Asylum is not the asylum I think you belong in...

    Spammer
    Spammer
    Spammer
    Spammer
     

Share This Page