Forum Moderators: phranque
I would like to redirect my url's through .htaccess. Its Apache/1.3.41 (Unix) type server.
http://example.com
http://example.com/index.htm
http://www.example.com/index.htm
to
http://www.example.com
I would like to know the code to redirect.
___________________
Actually I used
"RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com.com$
RewriteRule ^index.htm$ "http\:\/\/www\.example.com\.com" [R=301,L]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^/?$ "http\:\/\/www\.example.com\.com" [R=301,L]"
But it doesn't work and now If i type example.com, I was taken to parking page
_____________________
Please let me know about this. I looking forward for your reply. If you have any questions. Please let me know. Thanks.
# Redirect to canonical home page on canonical domain
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.htm\ HTTP/
RewriteRule ^index\.htm$ http://www.example.com/ [R=301,L]
#
# Redirect to canonical domain
RewriteCond %{HTTP_HOST} !^(www\.example.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]