I need to rewrite both the REQUEST_URI and the HTTP_HOST but I'm getting a redirection error when I implement this:
# Capture mysite.com/pages/123
RewriteCond %{REQUEST_URI} ^/pages/[0-9]+/?$
RewriteRule ^/pages/([0-9]+)/?$ /home/mysite/www/pages.php?id=$1
# Now capture the subdomain
RewriteCond %{HTTP_HOST} ^([a-z0-9]+).mysite.com
RewriteRule (.*) $1&subdomain=%1 [L,QSA]
What am I doing wrong here?
Thanks
I would try something like the following;
The first RewriteCond on
%{REQUEST_URI}
is probably unnecessary, because it contains the path component of the requested URI, which is already available in the RewriteRule Pattern match.