由网友(记住我)分享简介:我想使用的.htaccess和通配符子域实现解决方案,使I'm trying to implement a solution using .htaccess and wildcard subdomains so thathttp://subdomain.example.com 被映射到的 http://examp...
我想使用的.htaccess和通配符子域实现解决方案,使
I'm trying to implement a solution using .htaccess and wildcard subdomains so that
http://subdomain.example.com 被映射到的 http://example.com/index.php/accounts/subdomain/ 。我的规则看起来是这样的:
http://subdomain.example.com is mapped to http://example.com/index.php/accounts/subdomain/. My rules look something like:
RewriteCond %{HTTP_HOST} !www.example.com [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).example.com [NC]
RewriteRule ^(.*/) /index.php [PT,L]
这工作,但无视一切。当我尝试附加任何规则,例如:
Which works, but disregards everything else. When I try appending anything to the rule e.g:
RewriteRule ^(.*/) /index.php/hello [PT,L]
我得到一个500内部服务器错误。我如何得到这个工作?
I get a 500 internal server error. How do I get this working?
推荐答案
您可能需要排除的index.php
从您的规则:
You probably need to exclude the index.php
from your rule:
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).example.com$ [NC]
RewriteRule !^index.php($|/) index.php/accounts/%2%{REQUEST_URI} [PT,L]
相关推荐
最新文章