Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andyjamesnelson

macrumors 6502
Original poster
Aug 24, 2003
286
0
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: 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
 
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
 
@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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.