Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    432
    Thanks
    6
    Thanked 3 Times in 3 Posts

    multiple domain rewite.

    I am looking to find a way to redirect different domains to their www. counter parts.

    I have three sites that are 'add-on' domains and each one has their own folder for the sites files.

    But if someone visits site1.com they are not taken to www.site1.com, instead I get the default web site page. If I visit www.site1.com then all works ok, but not everyone would be using the www.

    What I wish to have is a rewite_mod that redirects the visitor that enters....

    site1.com taken to www.site1.com
    site2.com taken to www.site2.com
    and site3.com taken to www.site3.com

    I did try to use the cpanels redirect page but now I have messed up the main domains redirect and now this does not work at all!

    Can anyone give my some help on this please

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,293
    Thanks
    4
    Thanked 202 Times in 199 Posts
    In your .htaccess file in the folder for each site (changing the domain name of course):

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^site1.com$ [NC]
    RewriteRule ^(.*)$ http://www.site1.com/$1   [R=301,L]
    Dave .... HostMonster for all of your hosting needs

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Posts
    432
    Thanks
    6
    Thanked 3 Times in 3 Posts
    ah found out why, i did have that sort of thing in there, but just realised that i did not have it in the sub folder where the files are, i had it in the main root .htaccess


    Thank you anyway for replying as I would not have found out that i had it in the wrong place.

    cheers


  •  

    Posting Permissions

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