我正在尝试使用.htaccess和通配符子域实现解决方案,以便
http://example.com.domain.com已映射到http://domain.com/www/example.com
。我的规则看起来像:
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-\.]+)\.domain\.com$ [NC]
RewriteRule !^www/ www/%2%{REQUEST_URI} [PT,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
答案 0 :(得分:0)
尝试将第二条规则更改为:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^www/ index.php [L]