403禁止访问:您无权访问Codeigniter

时间:2018-06-07 14:06:20

标签: php codeigniter codeigniter-2

我正在尝试在wamp服务器中运行一个codeigniter项目但是我遇到了以下错误:

  

禁止您无权访问   / ecommerce_app / application / install / index在此服务器上。

这是我的项目.htaccess文件:

Deny from all
<FilesMatch "\.(gif|jpe?g|png|css|js)$">
Order allow,deny
Allow from all
</FilesMatch>
  

我的项目的网址:localhost / ecommerce_app / application / install / index

请帮助解决我的问题。

1 个答案:

答案 0 :(得分:0)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /app_subdirectory/

    RewriteCond $1 !^(index\.php|images|robots\.txt)

    #Removes access to the system folder by users.  
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php/$1 [L]

    #This snippet prevents user access to the application folder
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>