View Single Post
Old 12-13-2008, 03:09 PM  
leek
Confirmed User
 
leek's Avatar
 
Join Date: May 2008
Location: Charlotte, NC
Posts: 342
Quote:
Originally Posted by leek View Post
Something like this should do the trick:

Code:
RewriteEngine on
RewriteBase /
RewriteRule ^index\.(htm|html|php) http://www.yourdomain.com/ [R=301,L]
Of course, you'll need mod_rewrite enabled.
Quote:
Originally Posted by Doctor Feelgood View Post
# redirects index.php to main url
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.yoursite.com/$1 [R=301,L]
Doctor Feelgood's will work but it slightly more taxing on the RegEx engine and tries to do work on *all* requests that have index.php in them, which can interfere with other mod_rewrite rules.

Mine works for index.html, index.htm, and index.php only and shouldn't interfere with other rules.
leek is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote