I am trying to write an Apache mod_rewrite that can take in information from the subdomain, and after the domain and pass it as a couple of variables to a PHP script.
Here is what I have so far, with this I can either get the subdomain, or the URL arguments.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^./]+)\.domain\.com/([a-zA-Z0-9/-]+)$
RewriteCond %1 !=www
RewriteRule ^ redirect.php?subdomain=%1&args=$2
RewriteRule ^/?([a-zA-Z0-9/-]+)$ redirect.php?args=$1 [L]
mod_rewrite is enabled, and we are using a wildcard A-record to point all traffic to this server *.domain.com
Additionally, I do apologize if this is posted elsewhere, I have been trying to solve this off and on for the last month and have not figured it out, or found the answer posted anywhere.
RewriteCondwill never get a match, so I'm guessing just your secondRewriteRuleis working? – Shane Madden Dec 14 '11 at 6:51