2013-07-17 92 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

相关问题