Get rid of .html in url?

Discussion in 'Web Design and Development' started by andyjamesnelson, Sep 22, 2008.

  1. andyjamesnelson macrumors 6502

    Joined:
    Aug 24, 2003
    Location:
    Jacob's house
    #1
    Hey I want to know how I can get rid of the .html extension in a url?

    For example my site address is: andyjamesnelson.co.uk

    I saved another file into my directory called beatabet.html.

    I thought I would be able to type: andyjamesnelson.co.uk/beatabet and it would load the page but it doesn't it only loads if I add the.html

    Is there an easy way to get around this? I'm pretty sure one should try and keep urls as simple and short as possible.

    If you could help me out that would be ace. Thanks. Andy
     
  2. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #2
  3. andyjamesnelson thread starter macrumors 6502

    Joined:
    Aug 24, 2003
    Location:
    Jacob's house
    #3
    Ok I get that - but you really have to make a new directory for each address if you don't want to have the html extension in the url? That seems extreme?

    Andy
     
  4. design-is macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #4
    Its the only way I know of... its not a lot of extra effort to bung each page in its own folder.
     
  5. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #5
    @andyjamesnelson:

    It also keeps your content well organized. Especially if alot of content is involved, folders is a good thing.

    Of course there is a concept called friendly URL's which is documented here you might want to explore if you run Apache and have mod_rewrite enabled. It's a misconception people do that for security concerns or redirects (untrue), but use the examples to create your own rules to replace extensions with whatever you want and parse the arguments in your code accordingly. Google around for 'friendly url' for other examples.

    You could also use this method if you wanted all your content in one folder but custom arguments associated with each task, i.e. http://www.yourdomain.com/contactus or http://www.yourdomain.com/gallery/1/category/2/filename.mp3 where the first displays a contact us form and the second ties into a gallery script where gallery and category number and media file name are passed to it, but all live in your document root if you wish.

    Modern CMS's such as Drupal and Joomla also have options to enable friendly URL's if it's supported server side.

    -jim
     

Share This Page