Totoo
Totoo

Reputation: 33

Codeigniter cannot access controller without index.php

My local xampp codeigniter projec's url was http://localhost/ci_yudeesh/index.php But then wanted to remove the index.php part from the url so I followed the steps given in the userguide.

After that i could access the project without index.php with the url http://localhost/ci_yudeesh/

I have a controller named Home and I can access this using http://localhost/ci_yudeesh/index.php/home , but when try to access this using http://localhost/ci_yudeesh/home it gives this error:

error image

this is my config:

$config['base_url'] = 'http://localhost/ci_yudeesh/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

this is my .htaccess:

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

this is my route:

$route['default_controller'] = 'Home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Can someone help me fixing this? I tried all the other answers to similar type questions but none worked.

Upvotes: 0

Views: 1873

Answers (2)

Tanay Syed
Tanay Syed

Reputation: 17

Change the .htaccess file . Remove the codes from the existing file and add the following codes on the file :-

RewriteEngine on

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

RewriteBase /ci_yudeesh/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?/$1 [L]

Upvotes: 0

Parth Viramgama
Parth Viramgama

Reputation: 231

Remove the .htaccess from the application folder and put it outside the application folder and written only the below code in it. If it not work then I will give you another .htaccess code.

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

Upvotes: 3

Related Questions