繁体   English   中英

使用.htaccess从子域获取任何地址

[英]Get any address from subdomains with .htaccess

我想从子域到根获取任何URL(MVC引导)

我将以下代码用于根文件夹:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ boot.php?url=$1 [L]
#this code good working ... 

但是对于子域,如何获取不存在的文件?

#The following code is worked,but not get 404 folders Or files(!-d,!-f,!-l)
RewriteCond %{HTTP_HOST}  ^mySubDomain.domain.com [OR]
RewriteRule ^(.*)$ /../boot.php?url=$1 [L] 

我该如何添加:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

这个代码?

我解决了这个问题 ...

我在subdomian目录中创建.htaccess文件

并将此代码添加到.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /../boot.php?url=$1 [L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM