【发布时间】:2013-07-15 19:08:59
【问题描述】:
我想知道,如何让公众访问放置在名为“Sample”的文件夹中的文件,该文件夹位于 /applications/views/ 中。
我尝试使用 .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>
任何帮助将不胜感激。谢谢。
【问题讨论】:
-
您的公共文件应放在
./assets而不是./application不应从该文件夹向浏览器提供任何内容。
标签: php .htaccess codeigniter mod-rewrite