Hello and welcome to our community! Is this your first visit?
Register

Results 1 to 6 of 6
  1. #1
    WTF 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

  2. #2
    Administrator 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]

  3. #3
    WTF Lurker Array
    Join Date
    Feb 2006
    Posts
    73
    Thanks
    4
    Thanked 2 Times in 2 Posts


    So, just to clarify, just paste the above code into the .htaccess file.
    DaddyPlace.com - Dads Helping Dads with Fatherly Advice
    www.Daddyplace.com

  4. #4
    Administrator 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]

  5. #5
    WTF Lurker Array
    Join Date
    Feb 2006
    Posts
    73
    Thanks
    4
    Thanked 2 Times in 2 Posts


    Lol. So, which one to use?
    DaddyPlace.com - Dads Helping Dads with Fatherly Advice
    www.Daddyplace.com

  6. #6
    WTF Lurker Array
    Join Date
    Feb 2006
    Posts
    73
    Thanks
    4
    Thanked 2 Times in 2 Posts


    That worked! Thank you very much Jordan.
    DaddyPlace.com - Dads Helping Dads with Fatherly Advice
    www.Daddyplace.com


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •