I’ve got a wild card virtual host which I match with the following condition:
RewriteCond %{HTTP_HOST} ^([a-z0-9_\-]+)\.([\d]+)\.mydomain\.com [NC]
This rule works:
RewriteRule ^/?$ /index.php?customer=%1&cluster=%2&%{QUERY_STRING} [L]
However if I try to complicate the pattern at all:
RewriteRule ^([\w\-]+)/?$ /index.php?customer=%1&cluster=%2&load=$1&%{QUERY_STRING} [L]
It doesn’t catch it. What am I missing?
With the rules above:
http://dev.0.mydomain.com:8080/ works with the first rule
http://dev.0.mydomain.com:8080/x/ fails on the second rule (i.e. modified first rule, there’s only one rule)
Your second rule doesn’t include the leading slash. Assuming your rules are in vhost context, that part is needed. Specifically,
^([\w\-]+)doesn’t match/anything. This would:^/([\w\-]+).