.htaccess for ExpressionEngine

Expressionengine generated url contains index.php, if you want url working without index.php, you have to use .htaccess file
to redirected the request.
Defulte url like this
you want

follow the following steps
1. go to CP Home › Admin › System Preferences › General Configuration
there is a field name “Name of your site’s index page”, which has a value index.php
just remove this and leave this blank.

2. Now browse your site. you will see index.php is removed from you site, but your expected page
is not displayed, means request is not pointed properly. Let your new page is mydoamin.com/news/
. you have to point this url to mydomain/index.php/news/, which can be done by .htaccess with the
help of apache mod rewrite module. Most of the servers has this module enabled. But you have to
enable the mod-rewrite module on your local machine while working local. Find the file
find out the following line
#LoadModule rewrite_module modules/mod_rewrite.so
remove #, save and exit
restart your apache.

3. Now your mod-rewrite rule will work. so create a empty file and put the following line on htaccess.

Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteCond $1 !^(images|system|themes|sIFR|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^\.htaccess$ - [F]
RewriteRule ^favicon\.ico - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

if you want to skip rewrite for specific url, add it on line four.
if you are working on local, add the folder name on last line, let your folder name is ebay, so last line will be

RewriteRule ^(.*)$ /ebay/index.php/$1 [L]

3 thoughts on “.htaccess for ExpressionEngine

    • Yes Sahbaj, We can. If you create url with end with html for expressionengine, you need rewrite something like

      RewriteRule ^([a-zA-Z0-9_-\/]+)\.html$ /index.php/$1 [L]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s