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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can you fix this .htaccess rule?

    Basically I need this to not redirect subdomains that i specify.

    The line that says fivecows, when added to .htaccess gives me a "this page is not redirecting properly" error for my entire domain. If I eliminate that condition it works great to force everybody else to www.

    # start force www into URL for entire domain
    Options -Indexes
    Options +FollowSymLinks
    RewriteCond %{HTTP_HOST} !^fivecows\.thesmartass\.info [NC,OR]
    RewriteCond %{HTTP_HOST} !^www\.thesmartass\.info [NC]
    RewriteRule ^(.*)$ http://www.thesmartass.info/$1 [R=301,L]

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    360
    Thanks
    0
    Thanked 17 Times in 17 Posts
    You don't want the OR flag because as soon as it's not fivecows it ignores the next condition.

    Shorter
    Code:
    Options +FollowSymLinks  -Indexes
    
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} !^(www|fivecows)\.thesmartass\.info$ [NC]
    RewriteRule ^(.*)$ http://www.thesmartass.info/$1 [R=301,L]

  • #3
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting close

    ok, that rule no longer breaks site, and is oh so slim and trim, however it's still forcing people who type fivecows.thesmartass.info to www.thesmartass.info/fivecows just as it did before the fivecows part was added.

    I mean I am hosting the site free, but I don't want have to force him to appear to be in a directory of mine.

    any other thoughts?

  • #4
    Regular Coder
    Join Date
    Oct 2004
    Posts
    360
    Thanks
    0
    Thanked 17 Times in 17 Posts
    The mod_rewrite shouldn't do that. Does the redirect happen if you remove all the mod_rewrite? It might be how sub domains are set up in your hosting (to redirect), then you'd need to ask your host about it.

    Or is there any other mod_rewrite?

  • #5
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was going to say no, but the server i am on was recently changed and it seems even removing that rule that it still redirects that way...

    I checked my DNS and there is a CNAME pointing to the right spot.


  •  

    Posting Permissions

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