2013-07-17 101 views
2

我想知道,我如何能夠訪問公共文件,放置在放置在/ applications/views /內的名爲'Sample'的文件夾中。允許訪問Codeigniter中的 application 文件夾內的文件夾

我試圖用.htaccess文件來做到這一點。

這是我現在使用的.htaccess文件。

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /0.9.1 

#Removes access to the system folder by users. 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ /index.php/$1 [L] 

#Checks to see if the user is attempting to access a valid file, 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

#Enable access to the images and css folders, and the robots.txt file 
RewriteCond $1 !^(index\.php|application\views\Sample\/public) 
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

任何幫助,將不勝感激。謝謝。

+0

你的公共文件應該放在'。/ assets'中,而不是'。/ application'中,任何東西都不應該從該文件夾傳遞給瀏覽器。 –

回答

0

你把你的圖像,CSS,JS等在您的應用程序文件夾?如果您是請在此停靠。應用程序和系統文件夾不允許直接訪問腳本,應該保持這種方式。任何你想公開的東西都應該放在一個名爲public的文件夾中,並放在你的應用程序和系統目錄的根目錄下。

+0

嗯...我有點受夠了。但是,我現在堅持了別的東西。我在這裏發佈了另一個相關的問題:http://stackoverflow.com/questions/17697996/dynamic-folders-in-uploadfive-with-codeigniter如果你能幫助我,我會很感激。我喜歡你在回覆中大膽地使用。 +1 :) – chris

+0

謝謝,申請大膽是一種藝術 – Pattle

+0

Hhahah ..完全!! – chris

相關問題