1
我想這樣做。htaccess子域與獲取變量
user.mydomain.com -> mydomain.com/user.php?user=user
user.mydomain.com/content_(.*).xhtml -> mydomain.com/user.php?user=user&content=(.*)
user.mydomain.com/content_(.*).xhtml?get=(.*) ->mydomain.com/user.php?user=user&content=(.*)&get=(.*)
我已經嘗試過這個
<Directory "/var/www/html">
RewriteEngine On
# host doesn't start with www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^m\. [NC]
# host starts with something else
RewriteCond %{HTTP_HOST} ^([^\.]+)\.mydomain\.com$ [NC]
# rewrite
RewriteRule ^(.*)$ users.php?user=%1
RewriteRule ^users\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^content_(.*).xhtml$ users.php?user=%1&content=$1 [L,QSA]
</Directory>
,但它只有通過子域而不是內容的參數值。
由於它的工作原理:) :) – user3210116