Getting rid of index.php |
[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?
[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.
|
Welcome Guest, Not a member yet? Register Sign In |