Get rid of .html in url?

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

  1. andyjamesnelson macrumors 6502

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

    For example my site address is:

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

    I thought I would be able to type: 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


    Sep 26, 2006
  3. andyjamesnelson thread starter macrumors 6502

    Aug 24, 2003
    Jacob's house
    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?

  4. design-is macrumors 65816


    Oct 17, 2007
    London / U.K.
    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


    Dec 7, 2007
    Alexandria, VA, USA

    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. or 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.


Share This Page