Reputation: 21
I have the following url I want redirect using the .htaccess file in root with Mod Rewrite. I have searched and found good examples for the index file in root, but not in subfolder. This is what I have and what I need. Thank you in advance for your help.
/folder1/index.php /folder1/index.php/ to http://www.example.com/folder1/
/folder2/index.php /folder2/index.php/ to http://www.example.com/folder2/
I was asked for only 2 hyperlinks so I removed part of the link on the examples above. I appreciate the shorter way because I have many folders.
Upvotes: 2
Views: 1040
Reputation: 41219
To redirect /folder/index.php to /folder ,You can use :
RewriteEngine on
RewriteRule ^([^/]+)/index\.php$ /$1/ [NC,L,R]
This will redirect :
to
Upvotes: 0
Reputation: 891
Try this in your .htaccess file.
RewriteEngine On
Rewrite ^/folder1/index.php$ /folder1/ [L]
<Directory folder1>
DirectoryIndex index.php
</Directory>
Of course the index can be what every you want like newindex.php.
Upvotes: 0