Mobile app version of vmapp.org
Login or Join
Sherry384

: Htaccess redirect directories to index.html I am working on a site where I do not have permission to access the server config and someone else keeps changing the settings. That person just changed

@Sherry384

Posted in: #Directory #Htaccess

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


This Virtual Directory does not allow contents to be listed.


If you type in example.com/foo/index.html you can still see the file.

So I want to use .htaccess to redirect all URLs that end in a directory to 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$ /.html [R=301,L]


Any suggestions?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sherry384

1 Comments

Sorted by latest first Latest Oldest Best

 

@Angie530

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme