Force WWW except for Subdomains Issue

Thread Solved
Reply

Join Date: Jul 2004
Posts: 4
Reputation: Wolfy834 is an unknown quantity at this point 
Solved Threads: 0
Wolfy834's Avatar
Wolfy834 Wolfy834 is offline Offline
Newbie Poster

Force WWW except for Subdomains Issue

 
0
  #1
Jun 21st, 2009
I've been looking over the same .htaccess codes that will not work for a subdomain. It seems not many people really know how to do a correct .htaccess (including me I suppose). I've tried:

RewriteCond %{HTTP_HOST} !^site\.net$ [NC]
RewriteRule ^(.*)$ http://site.net/$1 [R=301,L]

And it requires the WWW on the subdomain, such as bob.site.net, which I do not want. Does anyone have a solution to my problem?
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 501
Reputation: blud will become famous soon enough blud will become famous soon enough 
Solved Threads: 15
Moderator
Staff Writer
blud blud is offline Offline
Linux Reject

Re: Force WWW except for Subdomains Issue

 
0
  #2
Jun 23rd, 2009
So, basically starting off reading your rule, it says:
If someone accesses this site that is *NOT* from http://site.net
Then redirect them to http://site.net/string

Maybe removing the 'NOT' is what your looking for:
RewriteCond %{HTTP_HOST} ^site\.net$ [NC]
RewriteRule ^(.*)$ http://www.site.net/$1 [R=301,L]

Which would state, if someone is accessing your site from site.net redirect to www.site.net/string

This rule would activate for anyone hitting http://site.net but not http://bob.site.net

Is this the goal?
--
<Something clever here>
RHCDS/MCP/DCSP
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 4
Reputation: Wolfy834 is an unknown quantity at this point 
Solved Threads: 0
Wolfy834's Avatar
Wolfy834 Wolfy834 is offline Offline
Newbie Poster

Re: Force WWW except for Subdomains Issue

 
0
  #3
Jun 25th, 2009
Yes, that worked. Thanks mate! Its so difficult finding any good information about htaccess. It seems no one really knows it well enough.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Linux Servers and Apache Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC