File structure: /www/file.(php|html) , /www/folder/file.(php|html) Is it possible to to loose the .php and .html in the url? In other words rewrite the URL to access it from http://localhost/file and http://localhost/folder/file
Try this: RewriteEngine on RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html Code (markup): There is an ambiguous case when you request http://example.com/file and both file.html and file.php exist. This rule will choose file.php.
You can only do something close to this if you have something unique in the URLs so apache knows if the page is from .html or .php. For example domain.com/whatever/ can only point to html OR php. Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^folder/([^.]+)/$ folder/$1.php [L] RewriteRule ^([^.]+)/$ $1.php [L] to get rid of the php.