|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| 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
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I have been trying to search for information on the code for a 301 redirect. I have included this in my .htaccess file
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC] RewriteRule (.*) http://www.mysite.com/$1 [R=301,L] I am trying to redirect the non www site to the www site. When I put this up and check the browser using http://mysite.com it goes to: http://www.mysite.com/mysite/index.html I am also trying to redirect (both www and non www) www.oldsite.com to www.mysite.com I don't know if this is the place to ask but I am desperate.
__________________
Original Vintage designed t-shirts at http://www.vintagedge.com |
|
|||
|
Try this code, it has worked for me:
Quote:
__________________
----Don't Call Me Brian---- |
|
|||
|
Quote:
Yeah, that is the trick, also notice it does mysite.net to www.mysite.com as well. But you forgot the [NC] which means to ignore case: -------------------------- RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.(.*) [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] --------------------------
__________________
http://MADEinUSA.org and others. Last edited by jrb@w3f.com; 07-30-2007 at 05:16 PM. |
|
|||
|
This is great for Apache - any best practices anybody would like to share for implementing this on IIS?
|
|
|||
|
Thanks for the replies.
I have found that it is a requirement to to have mod_rewrite enabled on Apache - anybody with any idea how to do that? It is running on a Mac OS X Server. I am switching service providers for DSL so service is up and down so sorry I didn't respond to these helpful suggestions earlier.
__________________
Original Vintage designed t-shirts at http://www.vintagedge.com |
|
|||
|
I tried the above and it did not work it switches to
www.mysite.com/mysite It seems that it is looking for a folder that is not there maybe?
__________________
Original Vintage designed t-shirts at http://www.vintagedge.com |
|
|||
|
thanks jrb@w3f.com, i did forget that - nice catch
mod_rewrite needs to be enabled in apache's config file
__________________
----Don't Call Me Brian---- |
|
|||
|
Thanks. Can you tell me how to do that? My service provider is unsure.
__________________
Original Vintage designed t-shirts at http://www.vintagedge.com |
|
|||
|
Quote:
Okay, here: Quote:
__________________
----Don't Call Me Brian---- |
|
|||
|
Thanks. I will let them know.
__________________
Original Vintage designed t-shirts at http://www.vintagedge.com |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how do I 301 redirect? | Cloggie192 | Google Discussion Forum | 7 | 07-12-2007 12:06 PM |
| Is a 301 redirect the best way? | raj7 | Search Engine Optimization Forum | 5 | 05-05-2007 04:05 AM |
| 301 Redirect | gbb011 | Search Engine Optimization Forum | 11 | 04-27-2007 02:08 AM |
| 301 redirect | jasonashby | Search Engine Optimization Forum | 11 | 04-17-2006 06:23 PM |
| 301 redirect | schmeetz | Web Programming Discussion Forum | 11 | 08-10-2005 02:54 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |