禁止:此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误

时间:2014-08-25 04:35:47

标签: .htaccess codeigniter

嗨我在我的服务器上有这个文件夹,它是客户端/ nannyshareaustralia,即时通讯使用codeigniter框架我已经在基本网址中设置了config.php。我也加入了htaccess文件

RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]

当我将它运行到浏览器时,这就是它的内容

Forbidden

You don't have permission to access /clients/nannyshareaustralia on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

有人可以帮我解决这个问题吗?非常感谢任何帮助

2 个答案:

答案 0 :(得分:2)

RewriteEngine On
RewriteBase /clients/nannyshareaustralia
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
....

RewriteBase添加了.htaccess规则,授予您在服务器上启用mod_rewrite的权限。

注意 如果您访问www.domain.com/clients/nannyshareaustralia之类的目录,则必须将RewriteBase添加到.htaccess

但如果某个网址/域指向文件夹clients/nannyshareaustralia,则不需要RewriteBase

答案 1 :(得分:2)

请尝试以下代码写入.htaccess文件

  

上的RewriteEngine      


  RewriteBase /
  RewriteCond%{REQUEST_FILENAME}! - f
  RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule。 /index.php [L]
< / IfModule>