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 2 of 2
  1. #1
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,302
    Thanks
    4
    Thanked 204 Times in 201 Posts

    Adding www for all but 1 sub-domain name

    This should be simple but I'm not having any luck getting the rules correct. I started off with the following to always have the www added to the domain if it wasn't already there and it works just like it should.

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.dynacompsolutions\.com$    [NC]
    RewriteRule ^(.*)$ http://www.dynacompsolutions.com/$1 [R=301,L]
    I have a sub-domain named forums.dynacompsolutions.com that I do NOT want the www added to. With the rules above it is getting written as http://www.dynacompsolutions.com/Forums and although that works it is not how I want the URL to be bookmarked/used.

    I tried adding
    Code:
    RewriteRule ^{HTTP_HOST}/Forums "http://Forums.dynacompsolutions.com/$1 [L]
    before the RewriteCond shown above and although it didn't generate any complaints it also does not do any rewriting.

    The complete set of rules I currently haven't which aren't doing what I'd like them to do is:

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteRule ^{HTTP_HOST}/Forums/ "http://forums.dynacompsolutions.com/index.php [L]
    RewriteCond %{HTTP_HOST} !^www\.dynacompsolutions\.com$    [NC]
    RewriteRule ^(.*)$ http://www.dynacompsolutions.com/$1 [R=301,L]
    A pointer or suggestion on where I'm going wrong with this would be much appreciated. I keep trying things but most of them cause Apache to complain severely and I keep taking the site down as a result.
    Dave .... HostMonster for all of your hosting needs

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,302
    Thanks
    4
    Thanked 204 Times in 201 Posts
    Gentle nudge ... any suggestions, wild or otherwise, would be greatly appreciated.
    Dave .... HostMonster for all of your hosting needs


  •  

    Posting Permissions

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