简体   繁体   中英

Access denied error in codeigniter url is having index.php

I am having issue which is may be related to .htaccess or php configuration of ubuntu. I have tried lot to find out solution but feels helpless so, at last i decided to post a question here. May be my question is silly or may i am making mistake on very normal configuration point but at last i hope my question will helps me to find out a solution with all yours blessings..

Please, support me to find out way for my issue.

My issue is when i am opening url without having index.php in url it gives output success but once i put index.php in url it gives only "Access Denied" in response.

Example

It gives me "Access Denied" in response

It gives access denied

It working fine but my all url change took longer time to change

It's working fine

MY .htaccess

<IfModule mod_env.c>
    SetEnv CI_ENV development
</IfModule>

<IfModule mod_rewrite.c>

RewriteEngine On
#RewriteBase /CodeIgniter_2.0.3

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

#Checks to see if the user is attempting to access a valid file,
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#Enable access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|assets|files|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]

</IfModule>
#Allow access from all domains for webfonts.
<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css|js|jpg|jpeg|png|gif|swf)$">
    Header set Access-Control-Allow-Origin "*"
    Header set Cache-Control "max-age=604800, public"
  </FilesMatch>
</IfModule>

I can't find way to come out from this issue. your help will be appreciated

Thanks for visiting...

try to put these on your .htaccess
i always use it on apache server and it works

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM