![]() |
mod_rewrite : Getting rid of index.php in the URI - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: mod_rewrite : Getting rid of index.php in the URI (/showthread.php?tid=6196) |
mod_rewrite : Getting rid of index.php in the URI - El Forum - 02-18-2008 [eluser]harmstra[/eluser] Not a question, but an answer. I've been trying to get rid of the index.php part in the URI. I've tried all kinds of different mod_rewrite rules, but nothing seemed to work. Lots of threads on this board talk about this issue, so lots of people struggle with it. After reading tons of posts, I came upon THE post. So here's the solution. You need to set $config['index_page'] in the conifg.php Default setting is: $config['index_page'] = "index.php"; change it to $config['index_page'] = ""; mod_rewrite : Getting rid of index.php in the URI - El Forum - 02-18-2008 [eluser]Benjamin David[/eluser] You can also find theses kind of informations in the user guide you know : http://ellislab.com/codeigniter/user-guide/general/urls.html The config file is also clearly documented, check out above the $config['index_page'] option, you'll find this : Code: /* mod_rewrite : Getting rid of index.php in the URI - El Forum - 03-08-2008 [eluser]nuttynibbles[/eluser] hi, i read ur solutions and set blank for it but it still wont work for me. is there any other configuration to be done? tks mod_rewrite : Getting rid of index.php in the URI - El Forum - 03-09-2008 [eluser]dmiden[/eluser] nuttynibbles: are you trying to use mod_rewrite? in that case try this in your .htaccess file: Code: RewriteCond $1 !^(index\.php|images|js|css|files|robots\.txt) Remember to save it as ".htaccess" in your web root directory. (Same dir as "index.php"). mod_rewrite : Getting rid of index.php in the URI - El Forum - 03-11-2008 [eluser]nuttynibbles[/eluser] hi, here is my directory structure: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/example/public_html/CodeIgniter_1.6.1/ system/ userguide.php index.php ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/example/public_html/web/ application/ .htaccess index.php ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -i manage to remove index.php from the uri. -after relocating my folders, it stop working - this is my directory settings for index.php in /home/example/public_html/web/index.php, $system_folder = "/home/example/public_html/CodeIgniter_1.6.1/system"; $application_folder = "application"; my .htaccess setting is: Options -indexes DirectoryIndex index.php RewriteEngine On RewriteBase /demo/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1/ [L] i'm puzzled of why it stop working. all i did was change the directory of the system folders. mod_rewrite : Getting rid of index.php in the URI - El Forum - 03-11-2008 [eluser]nuttynibbles[/eluser] omg it works already. removed RewriteBase /demo/ and it works. so sorry for the trouble |