site.com to www.site.com except sub.site.com and sub1.site.com - htaccess help

Discussion in 'Apache' started by drig, Dec 25, 2006.

  1. #1
    I need a little help, well confirmation actually, that my .htaccess is correct here. Id like to do the following:
    site.com to www.site.com
    except sub.site.com
    except sub1.site.com

    Would it read,
    
    Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} !^www|sub|sub1\.site\.com RewriteRule ^(.*)$ http://www.site.com/$1 [R=permanent,L]
    Code (markup):
    Thanks.
     
    drig, Dec 25, 2006 IP
  2. drig

    drig Peon

    Messages:
    4,188
    Likes Received:
    175
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If some one can give me an definite answer, I send $5 via paypal. Thanks and happy holidays.
     
    drig, Dec 26, 2006 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^DOMAIN\.com [NC]
    RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,L]

    at www.domain.com/.htaccess
     
    Nintendo, Dec 26, 2006 IP
    drig likes this.
  4. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Dont care about sub.site.com and sub1.site.com, they are not connected to site.co or www.site.com. They are indipendent sites.
     
    login, Dec 26, 2006 IP
    drig likes this.
  5. drig

    drig Peon

    Messages:
    4,188
    Likes Received:
    175
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry for your late reply, the code you provided is working flawlessly. Please send your paypal email to me via PM, so I can send you $5. Also, rep added to the both of you. Thanks.
     
    drig, Dec 27, 2006 IP