View Complete Thread
  • Re: Wildcard host header support

    Jul 21, 2009 10:53 AM|AJStevens|LINK

    I'm now using this rule:

    RewriteEngine on

    # subdomains to for futher processing

    RewriteCond %{HTTPS} (on)?
    RewriteCond %{HTTP_HOST} ^(?!www\.)[^.]+\.([^.]+\.[^.]{2,3}(?:\.[^.]{2,3})?)$ [NC]
    RewriteRule (.*) http(?%1s)://www.%2/$1 [P,NC,QSA]

    and I'm using $_SERVER['HTTP_X_FORWARDED_HOST'] in my php page, which returns you can of course then trim this down to just subdomain for use in your code.

    I'm waiting on my host to apply it to a .htaccess file in the Default Website.