View Full Version : Can you fix this .htaccess rule?

07-20-2007, 07:02 PM
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]

07-20-2007, 09:19 PM
You don't want the OR flag because as soon as it's not fivecows it ignores the next condition.


Options +FollowSymLinks -Indexes

RewriteEngine On

RewriteCond %{HTTP_HOST} !^(www|fivecows)\.thesmartass\.info$ [NC]
RewriteRule ^(.*)$ http://www.thesmartass.info/$1 [R=301,L]

07-20-2007, 10:48 PM
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?

07-20-2007, 11:36 PM
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?

07-20-2007, 11:44 PM
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.