Search code examples
.htaccesscodeignitercodeigniter-2codeigniter-routing

htaccess file misconfigured


I am using codeigniter php framework. I am trying to access a folder under public_html, but I can't get to it. It shows 404 custom page by codeigniter. Does the following script in .htaccess has something to do with it?

RewriteEngine on
RewriteCond $1 !^(index\.php|js|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Thanks


Solution

  • It probably is, you can try adding either some conditions:

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

    Or include your folder as part of the exclusion (example, your folder is "foobar"):

    RewriteEngine on
    RewriteCond $1 !^(index\.php|js|images|robots\.txt|foobar)
    RewriteRule ^(.*)$ /index.php/$1 [L]