Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

using htaccess for static website

lots of folders with index.html

7:49 am on Jun 21, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 2, 2003
votes: 0

i have my client website whihc is a static website having appx 5000 static folders and each folder has index.html inside. he has both the version indexed in the engines like
/folder/ & /folder/index.html which are serving the same content, i want to remove the canonical issue and want to redirect all the

/folder/index.html to /folder/ in htaccess.

Please suggest, so i dont need to edit the all 5000 folder for the correct linking and then redirecting and all.

8:04 am on June 21, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

That redirect is two lines of code, and the RewriteCond should test THE_REQUEST.

A quick check shows the code has been posted nearly 2000 times before in this very forum.


Use code that has been posted in the last few months, not some version from years ago. You need a directive that preserves the requested path in the redirect.

You DO also need to fix the links on the site to point to
but you can work on that over time.