Reputation: 231
I am new to Codeigniter I have put an .htaccess in root folder of codeigniter 2.1.3. I have tried my .htaccess file on both xampp & wamp server but this is not removing my index.php. I have also set
$config['index_page'] = 'index.php';
to
$config['index_page'] = '';
and here is my .htaccess code
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|js|images|system\/plugins|robots\.txt|css\/)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
i dont know why this is not removing my index.php page from url. help me!!
Upvotes: 2
Views: 2528
Reputation: 93
Another sily problem that could be done is that the folder that contains the application is not 755.
For be more sure about what is the problem look your apache log file , in linux /var/log/apache/error.log
Upvotes: 0
Reputation: 6860
Check whether rewrite_module is configured as on
And try removing the condition from your code:
RewriteEngine on
RewriteCond $1 !^(index\.php|js|images|system\/plugins|robots\.txt|css\/)
RewriteRule ^(.*)$ index.php/$1 [L]
Upvotes: 1
Reputation: 4578
I used this code in my project it works for me,
.htaccess :-
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
config.php :-
$config['index_page'] = '';
$config['base_url'] = 'http://www.example.com/';
I hope this will help you
Upvotes: 0
Reputation: 5627
Open config.php make sure to change $config['uri_protocol']= 'REQUEST_URI';
and in place this code in .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|indexcp\.php?|resources|robots\.txt)
RewriteRule ^([A-Za-z0-9_/.-]+)$ index.php?/welcome/$1
That's all it works for me. Let me know if you are still facing any problem.
Upvotes: 4