题
我需要在mod_rewrite表达式中快速修复我们的drupal
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
但我需要将子域的值重定向到get,所以我需要能够提供的东西:
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?subdomain=THE SUBDOMAIN HERE&q=$1 [L,QSA]
不知道怎么做,请帮忙!
解决方案
再次尝试此操作,由于某些原因我的代码无法正常呈现。
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{HTTP_HOST} ^(.*)\.mydomain\.com$
RewriteRule ^(.*) index.php?subdomain=%1&q=1 [L,QSA]
根据一些论坛帖子,我发现此处。
其他提示
您实际上不需要查询字符串中的子域。
可以在$ _SERVER ['SERVER_NAME']中的PHP中找到子域。
PHP文档说:
'SERVER_NAME'
The name of the server host under which the
current script is executing. If the script
is running on a virtual host, this will be
the value defined for that virtual host.
不隶属于 StackOverflow