CodeIgniter htaccess + awstats 密码保护碰撞
我在网上搜索了一段时间,找不到以下问题的正确答案:
我有一个用于 codeigniter 应用程序的工作 .htaccess (已删除 index.php ),如下所示:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
并且 /awstats/.htaccess 有以下规则:
Options +ExecCGI
AddHandler cgi-script pl
DirectoryIndex awstats.pl
AuthUserFile /home/MY_USER/domains/mydomain.com/public_html/awstats/.htpasswd
AuthType Basic
AuthName "AwStats Protection"
<LIMIT GET POST>
require valid-user
</LIMIT>
当我没有使用带有密码保护的 awstats 时 ->一切都很好。 启用awstats密码保护后->当我尝试访问 mydomain/awstats 时,CI 显示 404 错误。如何解决这个问题?
注意:mydomain.com / MY_USER 只是为了示例:-)
I've searched the web for a while and couldn't find the correct answer for the following problem:
I have a working .htaccess for codeigniter app (index.php removed ) which looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
And the /awstats/.htaccess has the following rules:
Options +ExecCGI
AddHandler cgi-script pl
DirectoryIndex awstats.pl
AuthUserFile /home/MY_USER/domains/mydomain.com/public_html/awstats/.htpasswd
AuthType Basic
AuthName "AwStats Protection"
<LIMIT GET POST>
require valid-user
</LIMIT>
When I did not use awstats with password protection -> everything worked just fine.
After enabling password protection for awstats -> CI shows a 404 error when I try to access mydomain/awstats. how can that be fixed?
Note: mydomain.com / MY_USER is just for the sake of the example :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
相反,
您可以这样做:
这样您就可以显式授予对不需要通过 CI 前端控制器的任何内容的访问权限。这是一种更安全的技术,但要求您显式添加每个文件和目录(例如图像、css 等)。
Instead of this:
You can do this:
So you can explicitly grant access to anything that doesn't need to go through CI's front controller. This is a safer technique, but requires that you explicitly add every file and directory (e.g. images, css, etc).