.htaccess redirect issue

Discussion in 'Apache' started by FlexiHost, Jun 30, 2010.

  1. #1
    Hi there all, we have the following in our htaccess, for auto creating sub domains:

    
    RewriteCond %{REQUEST_URI} !^/-
    RewriteCond %{HTTP_HOST} ^([^\./]+)
    RewriteCond %{DOCUMENT_ROOT}/domains/-%1 -d
    RewriteRule ^([^.]*)$ domains/-%1/ [L]
    
    Code (markup):
    Now, works perfert for http://sub.domain.com but if you try to go to http://www.sub.domain.com it just shows the main site at domain.com not the sub.domain.com one.

    Thoughts please.
     
    FlexiHost, Jun 30, 2010 IP
  2. FlexiHost

    FlexiHost Member

    Messages:
    236
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #2
    Anyone got any suggestions on this issue please?

    Have also tried:
    
    RewriteCond %{REQUEST_URI} !^/-
    RewriteCond %{HTTP_HOST} !^www\.domain\.co.\nz$ [NC]
    RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.domain\.co.\nzt$ [NC]
    RewriteCond %{DOCUMENT_ROOT}/domains/-%1 -d
    RewriteRule ^([^.]*)$ domains/-%1/ [L]
    
    Code (markup):
    Still no go...
     
    FlexiHost, Jul 2, 2010 IP