|
Home > Archive > Apache Server configuration support > July 2006 > mod_rewrite question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
mod_rewrite question
|
|
| michael.mior@gmail.com 2006-07-16, 7:22 pm |
| The following rule is not working:
RewriteEngine On
RewriteRule ^(.*)\.domain\.com/(.*)$
/home/domain/public_html/main/index.php?source=$1&page=$2
Basically I would like any subdomain of my domain to be forwarded to
the index.php file passing the subdomain name as the value of source
and the page on the subdomain as the value of page. Any help would be
greatly appreciated!
| |
|
| <michael.mior@gmail.com> schreef in bericht
news:1153078557.015630.51860@h48g2000cwc.googlegroups.com...
> The following rule is not working:
>
> RewriteEngine On
> RewriteRule ^(.*)\.domain\.com/(.*)$
> /home/domain/public_html/main/index.php?source=$1&page=$2
>
> Basically I would like any subdomain of my domain to be forwarded to
> the index.php file passing the subdomain name as the value of source
> and the page on the subdomain as the value of page. Any help would be
> greatly appreciated!
>
Do you have a DNS record for any subdomain other than www pointing to your
server or a wildcard for all? Without a request will not ever reach apache!
Further, apache has to be configured slightly off standard to have a single
(virtual) respond to all, without listing all valid names as a serveralias
in its config.
Your rewriterule assumes domain and subdomain to be part of the request
rewritten, however THEY ARE NOT -but on a proxy-. Further rewriting any and
all request to a script, assumes that script to pass all images, style
sheets and javascript too.
You might want to give this a try -it is untested and any risks are yours-
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$
RewriteRule ^(.*\.(htm|html))$
/home/domain/public_html/main/index.php?source=%1&page=$1
HansH
|
|
|
|
|