I\'d like to use mod rewrite in to convert web page addresses like /directory to /directory/index.html, in a standard LAMP hosting situatio
Use a RewriteCond
directive to check whether the URL path does not end with a .html
:
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule ^(.*[^/])?/?$ $1/index.html [L]
Edit You’re using a look-ahead assertion ((?!…)
). But there isn’t anything after .*
(only a $
). So try a look-behind assertion instead:
RewriteRule ^.*$(?
But note that you probably need Apache 2.2 to use these assertions.