Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CodeIgniter htaccess+awstats密码保护冲突_Php_.htaccess_Codeigniter_Mod Rewrite_Awstats - Fatal编程技术网

Php CodeIgniter htaccess+awstats密码保护冲突

Php CodeIgniter htaccess+awstats密码保护冲突,php,.htaccess,codeigniter,mod-rewrite,awstats,Php,.htaccess,Codeigniter,Mod Rewrite,Awstats,我在web上搜索了一段时间,未能找到以下问题的正确答案: 我删除了codeigniter应用程序index.php的.htaccess,如下所示: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{RE

我在web上搜索了一段时间,未能找到以下问题的正确答案:

我删除了codeigniter应用程序index.php的.htaccess,如下所示:

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_用户仅用于示例:-

而不是此:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
您可以这样做:

RewriteCond $1 !^(index\.php|favicon\.ico|favicon\.png|crossdomain\.xml|robots\.txt|images|css|js|awstats)
RewriteRule ^(.*)$ /index.php/$1 [L]

因此,您可以显式地授予对不需要通过CI前端控制器的任何内容的访问权限。这是一种更安全的技术,但要求您明确添加每个文件和目录,例如图像、css等。

您应该首先查看日志,访问和错误日志hmmm..仍然给我一个与CodeIgniter的冲突,CodeIgniter认为它是一个控制器,并给我一个404。