【问题标题】:Create .htaccess Wildcard with Subdomains使用子域创建 .htaccess 通配符
【发布时间】:2023-03-14 22:50:01
【问题描述】:

我正在尝试使用 .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]

【问题讨论】:

标签: .htaccess wildcard


【解决方案1】:

尝试将第二条规则更改为:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^www/ index.php [L]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-16
    • 1970-01-01
    • 2012-11-14
    • 2014-04-01
    • 1970-01-01
    • 2014-09-06
    • 2011-06-05
    • 2012-01-23
    相关资源
    最近更新 更多