.htaccess重定向到子文件夹(如果域名是基本域名)

.htaccess重定向到子文件夹(如果域名是基本域名),.htaccess,.htaccess,我会的 domain => subdomain.domain.com target => subdomain.domain.com/Controller/Method 重定向到目标(subdomain.domain.com/Controller/Method) 我尚未修复基本域名请尝试: IF %{HTTP_HOST} == base_url(subdomain.domain.com) 您可以使用以下规则: # Considering that base domain URL

我会的

domain => subdomain.domain.com
target => subdomain.domain.com/Controller/Method
重定向到目标(subdomain.domain.com/Controller/Method)

我尚未修复基本域名

请尝试:

IF %{HTTP_HOST} == base_url(subdomain.domain.com) 

您可以使用以下规则:

# Considering that base domain URL excludes index.html, index.php, welcome.html or something like that, we'll reduce matches to http(s)://base.subdomain/ and http(s)://base.subdomain
RewriteCond %{REQUEST_URI} ^\/?$
RewriteRule /Controller/Method
RewriteEngine on

##IF host==subdomain.domain.com##
RewriteCond %{HTTP_HOST} ^sudomain\.domain\.com$
##And uri==/##
RewriteCond %{REQUEST_URI} ^/$
##redirect to http://subdomain.domain.com/Contreller/method##
RewriteRule ^ http://subdomain.domain.com/Controller/method [NC,L,R]