Forum Moderators: phranque
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php¦html?)\ HTTP/
RewriteRule ^index\.(php¦html?)$ http://www.example.com/ [R=301,L]
#
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301.L]
Is there something I can add so that all my index files are redirected to the directory level? i.e. http://www.example.com/folder1/index.php to http://www.example.com/folder1/?
I tried to do redirects for the single pages by adding lines like:
RewriteRule ^folder1/index.php http://www.example.com/folder1/ [R=301,L]
but when loading these pages it comes up with the message "redirection limit for this URL exceeded".
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(php¦html?)\ HTTP/
RewriteRule ^([^/]+/)*index\.(php¦html?)$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301.L]
Jim