RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.example.com/$1 [R=301,L] The above code works when I want redirect this URL: http://www.example.com/index.php to this URL http://www.example.com/ How can I do the following redirect? This two URLs http://www.example.com/folder1/index.php http://www.example.com/folder1/index.php/ to this URL http://www.example.com/folder1/ I have a lot of folders, I something short and efficient. Thank you for your help.