Forum Moderators: phranque
RewriteCond %{THE_REQUEST} ^.*\/index\.html?\ HTTP/
RewriteRule ^(.*)index\.html?$ "/$1" [R=301,L]
rewriteCond %{http_host} ^domainthatredirects\.iw\.edu$ [OR]
rewriteCond %{http_host} ^www.domainthatredirects\.iw\.edu$ [OR]
rewriteCond %{http_host} ^www.maindomain\.iw\.edu$ [NC]
rewriteRule ^(.*)$ http://maindomain\.iw\.edu/$1 [r=301,L] # Externally redirect only direct client requests for /index.php
# and /index.html and /index.htm to URL ending with slash.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html?|php)$ http://example.com/$1 [R=301,L]
# Externally redirect to canonicalize the domain name if a non-canonical
# hostname is requested, in order to prevent duplicate-content problems
RewriteCond %{HTTP_HOST} !^(example\.com)?$
RewriteRule (.*) http://example.com/$1 [R=301,L]