homepage Welcome to WebmasterWorld Guest from 23.20.44.136
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

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

Apache Web Server Forum

    
Regarding URL Redirect
Kris999




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

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




msg:3956291
 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]

Jim

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