【问题标题】:htaccess file misconfiguredhtaccess 文件配置错误
【发布时间】:2013-10-18 17:52:25
【问题描述】:
我正在使用 codeigniter php 框架。我正在尝试访问 public_html 下的文件夹,但我无法访问它。它通过 codeigniter 显示 404 自定义页面。 .htaccess中的以下脚本是否与它有关?
RewriteEngine on
RewriteCond $1 !^(index\.php|js|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
谢谢
【问题讨论】:
标签:
.htaccess
codeigniter
codeigniter-2
codeigniter-routing
【解决方案1】:
可能是这样,您可以尝试添加一些条件:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|js|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
或者将您的文件夹作为排除项的一部分(例如,您的文件夹是“foobar”):
RewriteEngine on
RewriteCond $1 !^(index\.php|js|images|robots\.txt|foobar)
RewriteRule ^(.*)$ /index.php/$1 [L]