I want to map all my subdomain to folder.
For example subdomain.domain.com should display content of domain.com/clients/subdmain (Transparently)
RewriteCond %{HTTP_HOST} ^(.+)\.oomail\.org
RewriteCond %{HTTP_HOST} !^www\.oomail\.org [NC]
RewriteRule ^(.+)$ /var/www/clients/%1/$1
I got 500 Internal Server Error. To check whats the problem I appended [R] flag
RewriteRule ^(.+)$ /var/www/clients/%1/$1 [R]
I got this result in address bar
http://q1.oomail.org/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/var/www/clients/q1/always.html
Then I created a details.php file which dumps the $_GET variable details. Its content is
<pre>
<?php
var_dump($_GET);
?>
</pre>
and modified RewriteRule to (Note: I am sending $1 and %1 into details.php which shows its content)
RewriteRule ^(.+)$ details.php?p=%1&d=$1
And after opening http://subdomain.oomail.org/file.html
, I got output as
array(2) {
["p"]=>
string(9) "subdomain"
["d"]=>
string(11) "details.php"
}
Of which variable p is correct (value of %1) which is "subdomain", BUT d (value of $1) is details.php which I was expecting to be file.html which I opened in URL. Where am I going wrong? or How can I fetch file.html (URI) into variable for mapping?