2016-07-23 82 views
0

我在我的域中創建了一個文件夾,名爲:SquirrelMail如何讓用戶通過「.htaccess」訪問文件夾?

我有這個.htaccess

<IfModule mod_negotiation.c> 
    Options -MultiViews 
</IfModule> 

RewriteEngine On 


## 
## You may need to uncomment the following line for some hosting environments, 
## if you have installed to a subdirectory, enter the name here also. 
## 
# RewriteBase/

## 
## Black list protected files 
## 
RewriteRule ^themes/.*/(layouts|pages|partials)/.*.htm index.php [L,NC] 
RewriteRule ^bootstrap/.* index.php [L,NC] 
RewriteRule ^config/.* index.php [L,NC] 
RewriteRule ^vendor/.* index.php [L,NC] 
RewriteRule ^storage/cms/.* index.php [L,NC] 
RewriteRule ^storage/logs/.* index.php [L,NC] 
RewriteRule ^storage/framework/.* index.php [L,NC] 
RewriteRule ^storage/temp/protected/.* index.php [L,NC] 
RewriteRule ^storage/app/uploads/protected/.* index.php [L,NC] 

## 
## White listed folders and files 
## 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_URI} !\.js$ 
RewriteCond %{REQUEST_URI} !\.map$ 
RewriteCond %{REQUEST_URI} !\.ico$ 
RewriteCond %{REQUEST_URI} !\.jpg$ 
RewriteCond %{REQUEST_URI} !\.jpeg$ 
RewriteCond %{REQUEST_URI} !\.bmp$ 
RewriteCond %{REQUEST_URI} !\.png$ 
RewriteCond %{REQUEST_URI} !\.gif$ 
RewriteCond %{REQUEST_URI} !\.svg$ 
RewriteCond %{REQUEST_URI} !\.css$ 
RewriteCond %{REQUEST_URI} !\.less$ 
RewriteCond %{REQUEST_URI} !\.scss$ 
RewriteCond %{REQUEST_URI} !\.pdf$ 
RewriteCond %{REQUEST_URI} !\.swf$ 
RewriteCond %{REQUEST_URI} !\.txt$ 
RewriteCond %{REQUEST_URI} !\.xml$ 
RewriteCond %{REQUEST_URI} !\.xls$ 
RewriteCond %{REQUEST_URI} !\.eot$ 
RewriteCond %{REQUEST_URI} !\.woff$ 
RewriteCond %{REQUEST_URI} !\.woff2$ 
RewriteCond %{REQUEST_URI} !\.ttf$ 
RewriteCond %{REQUEST_URI} !\.flv$ 
RewriteCond %{REQUEST_URI} !\.wmv$ 
RewriteCond %{REQUEST_URI} !\.mp3$ 
RewriteCond %{REQUEST_URI} !\.ogg$ 
RewriteCond %{REQUEST_URI} !\.wav$ 
RewriteCond %{REQUEST_URI} !\.avi$ 
RewriteCond %{REQUEST_URI} !\.mov$ 
RewriteCond %{REQUEST_URI} !\.mp4$ 
RewriteCond %{REQUEST_URI} !\.mpeg$ 
RewriteCond %{REQUEST_URI} !\.webm$ 
RewriteCond %{REQUEST_URI} !\.mkv$ 
RewriteCond %{REQUEST_URI} !\.rar$ 
RewriteCond %{REQUEST_URI} !\.zip$ 
RewriteCond %{REQUEST_URI} !docs/.* 
RewriteCond %{REQUEST_URI} !themes/.* 
RewriteRule^index.php [L,NC] 

## 
## Standard routes 
## 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

每次,我去:mydomain.com/squirrelmail,我得到一個Page Not Found錯誤。

我應該在我的.htaccess中獲得什麼信息才能訪問我的SquirrelMail文件夾?

您的幫助將不勝感激!

.htaccessoctoberCMS默認值。我想通過創建一個文件夾來安裝SquirrelMail。我沒有訪問子域名,這就是爲什麼我這樣做的原因。

+0

您是否在mydomain.com/squirrelmail/目錄中有index.html或index.php? 你想讓它尋找一個索引:'RewriteRule^index.php [L]'? – Tsangares

+0

@Tsangares是的,我在我的/ squirrelmail /目錄中有一個index.php。 – PinoyStackOverflower

回答

0

10月份的.htaccess文件在穩定版本中使用了更新的方法,更符合您的要求。請參閱下面的新的白名單方式:

## 
## White listed folders 
## 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_FILENAME} !/storage/app/uploads/.* 
RewriteCond %{REQUEST_FILENAME} !/storage/app/media/.* 
RewriteCond %{REQUEST_FILENAME} !/storage/temp/public/.* 
RewriteCond %{REQUEST_FILENAME} !/themes/.*/(assets|resources)/.* 
RewriteCond %{REQUEST_FILENAME} !/plugins/.*/(assets|resources)/.* 
RewriteCond %{REQUEST_FILENAME} !/modules/.*/(assets|resources)/.* 
RewriteRule !^index.php index.php [L,NC] 

只需添加一個新行的文件夾,即應允許所有文件通過。

RewriteCond %{REQUEST_FILENAME} !/myfolder/.* 
相關問題