[英]Ignore directory in RewriteRule - .htaccess
I searched in internet for this, found alot of solutions but none of them worked. 我在互联网上搜索了此内容,找到了很多解决方案,但没有一个起作用。
I am using shared hosting and in this hosting all the websites data are in one public_html folder. 我正在使用共享托管,在此托管中,所有网站数据都位于一个public_html文件夹中。
I have .htaccess file in public_html folder which is for my main site named "mainexample.com" and all the other websites have folders named according to their domain. 我在public_html文件夹中有.htaccess文件,该文件用于我的主站点,名为“ mainexample.com”,所有其他网站的文件夹均根据其域命名。 eg "example1.com" and "example2.com".
例如“ example1.com”和“ example2.com”。
I want to ignore these "example1.com" and "example2.com" folder only. 我只想忽略这些“ example1.com”和“ example2.com”文件夹。
Below is my .htaccess code. 以下是我的.htaccess代码。
<IfModule mod_rewrite.c>
# index file can be index.php, home.php, default.php etc.
DirectoryIndex index.php
# Rewrite engine
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://www.mainexample.com%{REQUEST_URI} [R,L]
# condition with escaping special chars
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
将此规则插入RewriteEngine On
行下面以忽略所选文件夹:
RewriteRule ^(example1|example2)\.com(/|$) - [L,NC]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.