homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Regarding URL Redirect

5+ Year Member

Msg#: 3956173 posted 11:41 pm on Jul 20, 2009 (gmt 0)


I would like to redirect my url's through .htaccess. Its Apache/1.3.41 (Unix) type server.



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.



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

Msg#: 3956173 posted 5:02 am on Jul 21, 2009 (gmt 0)

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]


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved