Apache vhost modrewrite

Discussion in 'Apache' started by neodize, Mar 25, 2012.

  1. #1
    Hi,

    Im trying to make domain.com to redirect to www.domain.com and have test.domain.com to go to a folder. But nothing seems to work

    <virtualhost domain.com>
    </directory>
    RewriteEngine on
    RewriteCond ("RewriteCond%{HTTP_HOST} ^test\.domain\.com
    RewriteRule .* – [L]
    RewriteCond %{HTTP_HOST} !^www\.domain\.com
    RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
    </virtualhost>

    This is my code. Im lost. Can someone please show me the correct way to do this?

    Thx in advance
     
    neodize, Mar 25, 2012 IP
  2. cPAce

    cPAce Peon

    Messages:
    445
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well I can tell you now that this would not be a virtual host issue. This would be done in the .htaccess file for the account. I would need to double check how to right this in the htaccess and I will get back to you.
     
    cPAce, Mar 28, 2012 IP