I want to remove the index.php file from file path in CI . I am using ubuntu 12.04 . I tried almost all the forum result but no sucess .
I place the CI folder at this path .
http://localhost/xxx/CI/
I have apache rewrite mod enable .
sudo a2enmod rewrite
Module rewrite already enabled
I also have this in my conf.php file
$config['uri_protocol'] = 'AUTO';
$config['base_url'] = 'http://localhost/xxx/CI/';
$config['index_page'] = '';
$config['index_url'] = '';
I have this in my .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
.htaccess file is at this path
http://localhost/xxx/CI/.htaccess
and it is enable too through apache
/etc/apache2/sites-available/default
AllowOverride All
I get this error when i access the file like this
http://localhost/xxx/CI/login/
404 Error
The requested URL /xxx/CI/login/ was not found on this server.
Any help will be appreciated .
Thanks
Try using the .htaccess
file below:
RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]
Then, change your uri_protocol
from AUTO
to PATH_INFO
:
$config['uri_protocol'] = 'PATH_INFO';
If that starts re-routing everything to the default controller, then change it to ORIG_PATH_INFO
:
$config['uri_protocol'] = 'ORIG_PATH_INFO';
Additional Information
Insert these lines into your file:
Options -Multiviews +FollowSymLinks
AllowOverride All
Try below:
RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php/$1 [L]
And check "rewrite_module" of apache must be enabled.
and index_page in your config should be blank $config['index_page'] = '';
Do you have this code in your htaccess file
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
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.