簡體   English   中英

忽略RewriteRule中的目錄-.htaccess

[英]Ignore directory in RewriteRule - .htaccess

我在互聯網上搜索了此內容,找到了很多解決方案,但沒有一個起作用。

我正在使用共享托管,在此托管中,所有網站數據都位於一個public_html文件夾中。

我在public_html文件夾中有.htaccess文件,該文件用於我的主站點,名為“ mainexample.com”,所有其他網站的文件夾均根據其域命名。 例如“ example1.com”和“ example2.com”。

我只想忽略這些“ example1.com”和“ example2.com”文件夾。

以下是我的.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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM