Redirect all requests to default documents to their parent directory instead. This is an important SEO tactic to avoid duplicate content penalties due to both /directoryname/ and /directoryname/index.php both returning the same document response. This redirect should be Permanent (301).

To redirect all requests to one or more default documents to the parent directory url, add the following rule:

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

This rule would cause all requests to index.php or index.html anywhere in the site’s URL hierarchy to be redirected to the parent directory’s URL. For example, a request to /articles/index.php would be redirected to /articles/.

Change the file extension list (php|html) to your own website/language’s default document(s). Separate multiple entries with the pipe | symbol.