View Single Post
Old 08-28-2012, 03:29 PM   PM User | #2
handlegeek
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
handlegeek is an unknown quantity at this point
Quote:
#if the domain is not www.mydomain.com
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC]
#redirect to www.mydomain.com
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]
This is for redirecting from non-www domain to www domain
Example:
Code:
mydomain.com -> www.mydomain.com
NC => no case comparison
R=301 => 301 redirect
L => Last condition[/CODE]

Quote:
#leave this rule in place, but after the one above to handle the home page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ http://www.mydomain.com/$1 [R=301,L]
This is to extract directory path (uppercase letters - length between 3 to 9 characters) for the URLs ending with index.html and redirect to directory path.
For example:
Code:
www.mydomain.com/TEST/index.html -> www.mydomain.com/TEST/
%{THE_REQUEST} => Request URI (Ex:TEST/index.html)

For more details: http://www.ganeshbabujayaraman.com/a...and-drupal-cms
handlegeek is offline   Reply With Quote