Reputation: 91
Here is my htaccess for removing the index.php with codeigniter :
RewriteEngine On
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
But with this .htaccess, there is an error "File not found." So, I'm searching, and here is a little solution : http://forum.ovh.com/showthread.php?93572-Codeigniter-et-htaccess
Adding a "?" resolve the problem, but the site is sometimes very very slow, and sometimes very fast ! And sometimes, my style sheets don't load (assets/css/)...
What is the problem ? I think it's the htaccess but I'm not sure.
spec.: Host : OVH php ver. : 5.2 CI ver. : 2.1.4
Upvotes: 0
Views: 1992
Reputation: 116
Try this code from the OVH Forum:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Upvotes: 2
Reputation: 1549
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
write this in your htaccess check this link to enable mod_rewrite function of apache setting
Upvotes: 0
Reputation: 2218
try this out:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Upvotes: 0