mod_rewrite only one extension
- by Matthias Reisner
Currently I'm having the following htaccess content:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*).html$ $1.php
</IfModule>
I want to change the php extension to html. Now if I browse for localhost/xx.html I get the right content. BUT I also can use xx.php or xx to access the oontent! I only want to get the content if there is an html extension!
How can I make this work???
Example: On the server I have the file foo.php. Now I want the user to type in foo.html in the browser to get the content of foo.php. But if he types foo.php there will be an error.
I already tried this
RewriteRule ^(.*)[^\.html]$ error.php
RewriteRule ^(.*)\.html$ $1.php
But that does not really work
Thanks!