Results to achieve :
http://example.com/ -> /websites/dispatcher.php
http://another-example.com/ -> /websites/dispatcher.php
http://demo.example.com/ -> /websites/dispatcher.php?subdomain=demo
http://demo.example.com/cat/page.html -> /websites/dispatcher.php?subdomain=demo&path=/cat/page.html
With the .htaccess i have, it's working except for the "demo.exemple.com" who return a 502 error.
# Parse the subdomain as a variable
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^www
RewriteCond %{HTTP_HOST} ^([^\.]+)\.([^\.]+)\.([^\.]+)$
RewriteRule ^(.*)$ /$1?subdomain=%1
# Map all requests to the 'path' get variable in distpacher.php
RewriteRule ^distpacher\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /distpacher.php?path=$1 [L,QSA]
I'm having a hard time... any help, please?