- 02-11-2012 09:56 PM #1WTF Lurker Array
- Join Date
- Feb 2006
- Posts
- 73
- Thanks
- 4
- Thanked 2 Times in 2 Posts
How to make a redirect using apache
What is the best way, or how have you done it, to make a redirect and make all traffic to my site use www.mysite.com instead of mysite.com
My server uses apache and I want it to be permenate. I have already set my preference in google webmasters.
Thanks!DaddyPlace.com - Dads Helping Dads with Fatherly Advice
www.Daddyplace.com
- 02-12-2012 03:28 PM #2Administrator Array
- Join Date
- Jan 2010
- Posts
- 4,879
- Blog Entries
- 96
- Thanks
- 236
- Thanked 230 Times in 151 Posts
Use .htaccess.
Code:Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
- 02-12-2012 04:05 PM #3WTF Lurker Array
- Join Date
- Feb 2006
- Posts
- 73
- Thanks
- 4
- Thanked 2 Times in 2 Posts
DaddyPlace.com - Dads Helping Dads with Fatherly Advice
www.Daddyplace.com
- 02-12-2012 04:08 PM #4Administrator Array
- Join Date
- Jan 2010
- Posts
- 4,879
- Blog Entries
- 96
- Thanks
- 236
- Thanked 230 Times in 151 Posts
Yeah, that should work fine. I think I still have WTF's .htaccess redirect around (we use NGINX now). Let me check.
...
Here we go, a little different from the above example.
Code:RewriteCond %{HTTP_HOST} !^www.webmastertalkforums.com$ [NC] RewriteRule ^(.*)$ http://www.webmastertalkforums.com/$1 [L,R=301]
- 02-12-2012 04:16 PM #5WTF Lurker Array
- Join Date
- Feb 2006
- Posts
- 73
- Thanks
- 4
- Thanked 2 Times in 2 Posts
DaddyPlace.com - Dads Helping Dads with Fatherly Advice
www.Daddyplace.com
-
- 02-14-2012 07:27 PM #6WTF Lurker Array
- Join Date
- Feb 2006
- Posts
- 73
- Thanks
- 4
- Thanked 2 Times in 2 Posts
DaddyPlace.com - Dads Helping Dads with Fatherly Advice
www.Daddyplace.com



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks