dropping the .html suffix

dropping the .html suffix

Posted by: bowerbird
Posted on: 2007-03-08 14:45:00

i want to enable my users to drop the ".html" suffix.

so if they were to enter:
> http://www.mydomain.com/myantp123

i'd want them taken to:
> http://www.mydomain.com/myantp123.html

and of course i'd want that to generalize to any file.

it looks like i do this with mod_rewrite in my .htaccess file?

currently (and this must be the default), it looks like this:
> <Limit GET POST PUT>
> Order Allow,Deny
> Deny from All
> </Limit>

some googling indicates this might work?
> RewriteEngine on
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME}.html -f
> RewriteRule (.*) $1.html [L]

i'm not sure what the "l" flag does?
but will this work to do what i want?

thanks so much...

-bowerbird


Re: dropping the .html suffix

Posted by: kchrist
Posted on: 2007-03-08 16:20:00

You don't even need mod_rewrite for this. In your root-level .htaccess file, place this line:

Options  Multiviews

Note that you want to avoid having files with similar names if you do this (eg, cats.html and cats.jpg).

Read about Apache content negotiation for more information.