Getting rid of index.php - 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: Getting rid of index.php (/showthread.php?tid=20103) |
Getting rid of index.php - El Forum - 06-28-2009 [eluser]Unknown[/eluser] Hi, I'm making a digg-like site with CodeIgniter, and I have to say, I love it! But, the whole index.php in the URL is really starting to bother me. Take this URL: http://www.example.com/index.php/popular/all As opposed to: http://www.example.com/popular/all The second one looks much better, yes? I looked at the User Guide where it says how to do some mod_rewrite magic to change this, but to no avail. Help? Getting rid of index.php - El Forum - 06-28-2009 [eluser]Yadi Utama[/eluser] I think you have to make a .htaccess file into your root folder. Insert the list of codes below into your .htacces file: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / 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> But, you have to set the httpd.conf in your Apache webserver first as following instruction: 1. Make sure to unblock this line of code in your httpd.conf: LoadModule rewrite_module modules/mod_rewrite.so 2. Check the following code in your httpd.conf # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # #AllowOverride all 3. Make sure to unblock "AllowOverride All" as shown above. So it will be: # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride all 4. Restart your httpd service I think it will work as i have ever done with it. Good luck but i'm sorry because of my english not good. Getting rid of index.php - El Forum - 06-28-2009 [eluser]R. Oerlemans[/eluser] http://codeigniter.com/wiki/mod_rewrite/ That page might be useful. Getting rid of index.php - El Forum - 06-28-2009 [eluser]Unknown[/eluser] Thanks guys. Everything's working now. |