1
結果來實現:的.htaccess - 子域名和路徑GET變種
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
通過的.htaccess我有,它的工作除了「demo.exemple.com」誰返回502錯誤。
# 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]
我很難過......請幫忙嗎? (。*):
改變最後RewirteRule [L,QSA] **爲* ** RewriteRule ^(。*)$ /distpacher.php?path=$1 [L,R] ** – soewin