简体   繁体   English

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

[英]Get any address from subdomains with .htaccess

I want to get any urls from subdomains to root (mvc boot) 我想从子域到根获取任何URL(MVC引导)

I use from this code for root folders: 我将以下代码用于根文件夹:

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

But for subdomain, how do I get files that do not exist? 但是对于子域,如何获取不存在的文件?

#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] 

How can I add: 我该如何添加:

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

to this code? 这个代码?

i solved this problem ... 我解决了这个问题 ...

i create .htaccess file in subdomian directory 我在subdomian目录中创建.htaccess文件

and add this code to .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