Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am working on a site that where I do not have permission to the server and someone else keeps changing the settings. That person just changed the settings preventing users from going to and seeing the index page.

This Virtual Directory does not allow contents to be listed.

If you type in you can still see the file.

So I want to use htaccess to redirect all urls that end in a directory to change into directory/index.html How do I write that?

I started with some code that changes .php files to .html files and tried to work from that but I couldn't quite get it to work.

RewriteRule ^(.*)\.php$ /$1.html [R=301,L]

Any suggestions?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

What you're looking for is not a mod_rewrite directive - take a look at the Apache mod_dir documentation - something like this should be a good start for your .htaccess file:

DirectoryIndex index.php index.html index.htm
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.