Sunday, June 13, 2010
ExpressionEngine: Remove index.php from URLs
To start off my brand new site on a brand new host (linode.com) I am posting my first tutorial. This tutorial is for the ExpressionEngine and will teach you how to tidy up your URLs by removing index.php from them.
With some CMS software packages the functionality to remove the trigger file from the URL is built in, but with the ExpressionEngine this is not the case. Don't worry though as this is very simple to do manually by following these steps:
1. Create a file in the root directory of your ExpressionEngine install (this directory by default has the files index.php and path.php as well as the folders called images, system, and themes) called .htaccess.
2. Edit this newly created file in your favorite text editor and paste the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ /index.php?$1 [L]
</IfModule>
3. Save the .htaccess file
4. Log into your ExpressionEngine control panel and navigate to: Admin›System Preferences›General Configuration
5. Look for the field labeled Name of your site's index page. This field will be set to index.php. Just clear the field and leave it blank, then click the update button and you are done!
I hope this tutorial helps as the official documentation on this subject can be a bit confusing as they give way more information than you need. This concludes this tutorial and I hope to write more as I learn more about the ExpressionEngine!