mod_rewrite : Getting rid of index.php in the URI |
[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'] = "";
[eluser]Benjamin David[/eluser]
You can also find theses kind of informations in the user guide you know : http://ellislab.com/codeigniter/user-gui.../urls.html The config file is also clearly documented, check out above the $config['index_page'] option, you'll find this : Code: /*
[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
[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").
[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.
[eluser]nuttynibbles[/eluser]
omg it works already. removed RewriteBase /demo/ and it works. so sorry for the trouble |
Welcome Guest, Not a member yet? Register Sign In |