Hi,
I hope that you could help me, because I've spent hours on googling and
reading mod_rewrite docs and still can't get it working...
What I want to achieve as a final effect is that GET requests like
http://john.demo.myapp.com/
http://lucy.demo.myapp.com/
will be internally rewritten and served as
http://john.demo.myapp.com/usersite/john
http://lucy.demo.myapp.com/usersite/lucy
without redirects so URL in user's browser will remain clean, and I will
avoid one more request. It should give the same effect as typing e.g.
http://lucy.demo.myapp.com/usersite/lucy in the browser.
Here's my configuration:
Apache is already configured for *.demo.myapp.com like
<VirtualHost *:80>
ServerName demo.myapp.com
ServerAlias *.demo.myapp.com
DocumentRoot /some/path
# rest of config here
</VirtualHost>
I've tried to add
RewriteEngine On
RewriteCond %{HTTP_HOST} (.+)\.demo\.myapp\.com$
RewriteRule ^/$ /usersite/%1
but the effect is that apache is looking for a file
/some/path/usersite/lucy instead of rewriting query-string to
/usersite/lucy (later it is passed to the Ruby on Rails backend using
mod_passenger, but I've tried to do that without this module and I
encounter the same problems).
I've tried also to force it to treat this as an URL, not a path by
passing full URL:
RewriteEngine On
RewriteCond %{HTTP_HOST} (.+)\.demo\.myapp\.com$
RewriteRule ^/$ http://%0/usersite/%1
As log says, it constructs URL in a good way, but it invokes 302
redirect. In documentation, there's an information that if current host
matches host in second part of RewriteRule, schema and host got stripped
and query string is rewritten. It doesn't actually happen.
Any ideas? What am I making wrong? I use apache 2.2.
Thanks,
m.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
" from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org