mod_rewrite in per-server context
am 14.08.2007 02:49:26 von Hermann.Richter
On my local machine (Win32) I wanted to add a sub domain. so I put
this on the .htaccess of my document-root:
RewriteCond %{HTTP_HOST} ^subdomain\.
RewriteRule ^(.*)$ subdomain/$1
which worked fine. Every request to the subdomain is rewrited to the
directory "subdomain".
But now I want to do that in per-server context, inside a VirtualHost
directive, but it doesn't work.
I read the rewrite log and the directive never execute. It's like it
wasn't even there.
Any idea what the problem could be?
Thanks.
Re: mod_rewrite in per-server context
am 14.08.2007 18:41:17 von Hermann.Richter
>
> If you have a VirtualHost, only the domains/subdomains for which the
> vhost is configured will be handled by that vhost. You sure your problem
> isn't that you get a different vhost?
>
> > but it doesn't work.
>
> What do you mean "it doesn't work"? Do you get the VHost content?
> What apachectl configtest return?
The virtual host (the only one I have) is detected right.
I have the directive
ServerAlias *.mydomain
So anything like subdomain.mydomain matches that.
>
> AFAIK what you want to do is basically what is defined as
> "mass-defined-virtualhosts" (did you looked up the documentation?), so
> it shouldn't be a problem.
Unfortunately, I need this to work on a remote server where
mod_vhost_alias is not available.
I get it to work using .htaccess files. And in the rewrite log, I see
the steps in the rewriting process.
But when I move the directives to the VirtualHost context, the rewrite
log shows nothing about it (it doesn't even log that the rule doesn't
match). It's like apache doesn't see the rewriting directives in the
VirtualHost.