Removing "index.php" from CodeIgniter URLs
In CodeIgniter, the default URL format includes "index.php" in the path, which can be unsightly and inconvenient. To remove this redundancy, follow these steps:
Step 1: Create .htaccess File
Place a file named ".htaccess" in the root folder of your web application.
Step 2: Add Rewrite Rules
Add the following Rewrite rules to your .htaccess file:
RewriteEngine on RewriteCond !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt) RewriteRule ^(.*)$ /index.php/ [L]
Explanation:
Alternative Version:
For a more customizable version, you can refer to this snippet:
http://snipplr.com/view/5966/codeigniter-htaccess/
The above is the detailed content of How Can I Remove 'index.php' from My CodeIgniter URLs?. For more information, please follow other related articles on the PHP Chinese website!