I've pretty much hit a wall here. As far as I can tell, this should work, but it doesn't.
I have a local development address with a wildcard subdomain of *.localhost, and friendly URLs of /[0-9]/somestring. What I am trying to do is have username.localhost/1/page
to localhost?pageId=1&username=username
. The complication comes in trying to get both the home page at username.localhost as well as the individual pages i.e. username.localhost/1/page to both work.
RewriteRule ^([0-9]+)/[a-zA-Z0-9\-\_\,\.]+$ - [S=1]
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.localhost
RewriteRule ^index.php$ index.php?username=%1
RewriteRule ^([0-9]+)/[a-zA-Z0-9\-\_\,\.]+$ index.php?pageId=$1&username=%1
With /1/page pages, the first rule meant to skip matches and skips, but fails to rewrite correctly. However, if I remove the first 2 rules, it'll rewrite /1/page pages just fine.
It's as if it's not skipping, yet if i change it to S=2, it skips both rules. Argh. Any ideas?