iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-10-2005, 02:48 PM
WebProWorld New Member
 
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 10
inflectionpt RepRank 0
Default ModRewrite: How to redirect [domain].com to www.[domain].com

I need to redirect as suggested in the subject. I actually found some code but it seems to be doing 302s. Can someone help me out and post the code for mod rewrite that does this? The current code I have is the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} !www.domain.com
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R]

Thanks.
Reply With Quote
  #2 (permalink)  
Old 02-11-2005, 12:20 AM
Deep13's Avatar
WebProWorld Veteran
 
Join Date: Dec 2003
Location: India
Posts: 304
Deep13 RepRank 0
Default

try this and see

RewriteEngine On
RewriteCond %{HTTP_HOST} !www.domain.com
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

you can also check your headers here

Regards
Deep
Reply With Quote
  #3 (permalink)  
Old 02-12-2005, 09:12 AM
OleTom's Avatar
WebProWorld Member
 
Join Date: Jan 2004
Location: Out There Somewhere
Posts: 32
OleTom RepRank 0
Default

Code:
<HEAD><meta http-equiv="refresh" content="0; URL=http://www.yoursite.com"></HEAD>
This will work if you name index.html
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:16 PM.



Search Engine Optimization by vBSEO 3.3.0