2012-05-22 25 views
2

我有codeigniter項目讓我們說example.com。在我的服務器的public_html文件夾中,我創建了一個名爲test的文件夾,我希望能夠通過web訪問某個文件example.com/test/somefile.php如果codeigniter項目存在,如何通過瀏覽器訪問文件夾?

因爲我也有一個codeigniter項目同樣的public_html目錄,當我嘗試example.com/test/somefile.php時,我總是得到codeigniter頁面未找到錯誤。

我怎麼基本上可以告訴我的服務器或codeigniter項目文件夾「測試」不是codeigniter應用程序的一部分?

回答

3

在你.htaccesspublic_html根,你可能有這樣的事情通過的index.php路由的一切:http://codeigniter.com/user_guide/general/urls.html

RewriteEngine on 
# If the path doesn't start with one of these... 
RewriteCond $1 !^(index\.php|images|robots\.txt) 
# ...send the request to index.php/REQUEST 
RewriteRule ^(.*)$ /index.php/$1 [L] 

只需添加「:從CI用戶指南採取

例測試「到管道分隔組,或者您需要執行的任何操作以允許您的配置訪問目錄:

RewriteCond $1 !^(index\.php|test|images|robots\.txt) 
#       ^^^^ 

如果沒有此CI,需要URL中的index.php - 實際上沒有辦法讓您的Codeigniter應用程序本身重定向,重寫URL或阻止對/test目錄的訪問,它通常都是通過.htaccess文件完成的。

相關問題