I would like to change the rewrite rule to only apply to the current folder that the htaccess file is in
RewriteEngine on
RewriteRule ^(.*)\.html $1\.php
how do I change this to make that work? Thanks,
I would like to change the rewrite rule to only apply to the current folder that the htaccess file is in
RewriteEngine on
RewriteRule ^(.*)\.html $1\.php
how do I change this to make that work? Thanks,
If you have a limited number of known sub-directories I would do something like this:
RewriteCond %{REQUEST_URI} (list|of|sub|dirs)
RewriteRule . - [s=1]
RewriteRule ^(.*)\.html $1\.php
That skips the next 1 rule when the condition is true. You could change the [s=1]
to match any number of rules you want to not apply to the sub-directories.
Restrict your pattern to only match characters other than /
:
RewriteRule ^([^/]+)\.html$ $1.php