Forum Moderators: phranque
www.sample.com would pass along ?domain=sample.com.
So my question is how do I only grab the domain name and use it in my rewrite rule keeping in mind that there will be more to the url then just the domain since the websites are made up of several different pages.
An example might be:
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z][a-z0-9\-]*)\.example\.com
Note that the pattern allows only lowercase characters, numbers, or hyphens in the subdomain, in accordance with HTTP.
Jim
www.customdomain.com I could get a variable that says domain=customdomain.com .
Does that make sense? Thanks again for the reply. The only parts I'm having a hard time with was accounting for the "www" which yours does in the example above, but then also being able to grab just the domain name if there is anything in the url after that. So I could just check for the first instance of a "\" and grab everything in between but what if there isn't a "\"? How could I account for both?
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z][a-z0-9\-]+\.[a-z]{2,4}(\.[a-z]{2})?)
You will have to handle setting up the DNS to point these "custom" domains to your server's IP address, and the RewriteCond presented here is for a rule that would follow your existing "subdomain rule" in order to prevent conflicts between the two rules.
Jim