ExpressionEngine Docs

Removing index.php from URLs

The index.php appears in your URLs because it is the file responsible for processing all ExpressionEngine requests. Consider the following URL:

The template_group/template segments are simply information passed to index.php and do not refer to actual files or folders in the server’s filesystem.

Many servers support a technique called URL rewriting, which allows you to hide the index.php portion of the URL, but still process the request normally.


1. Create an .htaccess file

Using your FTP client, create a new file named .htaccess (including the leading dot) in the same folder as your site’s main index.php file.

Note: Files beginning with a dot are hidden by default on some operating systems, including Mac OS X. Ensure your FTP client is set to show all files, including hidden ones.

Then add the following code to this newly created .htaccess file.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]


2. Update General Configuration

In the Control Panel, go to Settings --> URL and Path Settings, set Website index page to blank (empty), and click Submit.

3. Test

Test your site’s links to ensure they are working properly with index.php removed.

Note: If using Multiple Site Manager, you can repeat the above steps for each site, assuming each site has its own web root.

Some common problems include links returning 404s, a “No Input File Specified” error, or all links returning the same content. This can often be the case with hosts (such as GoDaddy) that require you to force query strings. If this happens, follow the exception above for hosts that force query strings.

If you encounter a problem, you can rename .htaccess to something else (it only takes effect when it is named .htaccess) and set Name of your site’s index page in the CP back to index.php.