.htaccess for file extensions?

D

draphael

Hi,

Is there a way to configure .htaccess so that requests for files ending in
..htm are redirected to the same file name but with an extension of .html?

Requests for .htm pages are showing up in my error logs. The page name is
right but the extension should be .html. I don't know where these are coming
from, I'd rather that folks were directed to the correct page, rather than
the 404 page.

If it's possible I'd surely be grateful for the solution!

Thanks!!
DRaphael
 
M

Mitja Trampus

draphael said:
Hi,

Is there a way to configure .htaccess so that requests for files ending in
.htm are redirected to the same file name but with an extension of .html?

Use mod_rewrite or the simpler mod_alias.

I have very little experience with either, but I guess this
should work:
RedirectMatch permanent ^(.*)\.htm$ $1.html
 
D

draphael

Mitja Trampus said:
Use mod_rewrite or the simpler mod_alias.

I have very little experience with either, but I guess this should work:
RedirectMatch permanent ^(.*)\.htm$ $1.html

worked like a charm! thanks so much!

best,
DRaphael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top