How do I remove the "index.php"
sticking out in every path in codeigniter somewhere in the center?
I want clean non index.php-fied URLs
?
views:
2032answers:
5
A:
This is an .htaccess for one of my CI projects:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /projectFolder/index.php/$1 [L]
The last line should give you what you need, though you may or may not need '/projectFolder' depending on how your folder structure is set up. Good luck!
mrinject
2009-09-18 15:51:25
+2
A:
Have a look in the system\application\config\config.php file, there is a variable named 'index_page'
It should look like this
$config['index_page'] = "index.php";
change it to
$config['index_page'] = "";
Then as mentioned you need to add a rewrite rule to the .htaccess file
Re0sless
2009-09-18 15:52:01
+4
A:
If you are using Apache place a .htaccess file in your root web directory containing the following:
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Another good version is located here:
Sean Vieira
2009-09-18 15:53:45
+1 for the link! Although had to tweak around a bit. got it with this --> RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [QSA,L]
OrangeRind
2009-09-18 16:47:24
A:
Another solution I found is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /codeigniter
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Then, in the file system/applications/config/config.php...
$config['index_page'] = "index.php";
Remove the index.php and leave the file like this:
$config['index_page'] = "";
xterico
2010-03-23 22:28:44