Welcome to WebmasterWorld Guest from 50.17.79.100

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Regarding URL Redirect

     

Kris999

11:41 pm on Jul 20, 2009 (gmt 0)

5+ Year Member



Hi,

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.

jdMorgan

5:02 am on Jul 21, 2009 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



These subjects are already very-well covered here, but here's the code:

# 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]

Jim
 

Featured Threads

Hot Threads This Week

Hot Threads This Month