允许访问Codeigniter中application文件夹内的文件夹


Allow access to folder which is inside the application folder in Codeigniter

我想知道,如何将放置在/applications/views/中名为"Sample"的文件夹中的文件授予公众访问权限。

我试着用.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>

如有任何帮助,我们将不胜感激。非常感谢。

您是否将图像、css、js等放在应用程序文件夹中?如果您是,请立即停止。应用程序和系统文件夹不允许直接访问脚本,应该保持这种方式。任何想要公开的东西都应该放在一个名为public的文件夹中,并将其与应用程序和系统目录一起放在根目录中。