Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do you remove a .html extension or any extension using an .htaccess file?

share|improve this question
add comment

migrated from stackoverflow.com Dec 10 '09 at 14:01

This question came from our site for professional and enthusiast programmers.

1 Answer

Google is your friend :-)

Take a look at this article.

Code:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

Credit: http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess/

share|improve this answer
    
Agreed - just make sure that mod_rewrite is enabled and the above snipped should do what you need. –  EEAA Dec 10 '09 at 16:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.