Magento: How to remove “index.php” from the URL

When we build a new Magento site, we see all urls with “Index.php” in it. Often times it gets frustrating and people cant find a simple way of removing it to make url more tidy and SEO friendly. Today we are going to learn the easy way of removing “index.php” from Magento website url.

Now, let’s learn how to remove ‘index.php’ from the website URL:

  1. Go to System->Configuration tab:
  2. Then click “Web” tab under “General” on the left hand side of your admin panel. 
  3. Now set the “Use Web Server Rewrites” option under “Search Engines Optiomization” to “Yes”.
  4. Then, set the “Use Secure URLs in Frontend” option under “Secure” to “Yes”. Click “Save Config” button in the top right:
  5. Now we need to create an .htaccess file with the rewrite directives in the root of your Magento installation. Using FTP software (Filezilla), login to your website FTP and look for .htaccess file, once found, open it:  

PLEASE MAKE SURE TO BACK-UP YOUR .htaccess FILE BEFORE MAKING ANY CHANGES.

Now put the following code in the created file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

In case your Magento is installed in sub-folder, e.g. ‘shop’, you should use the following code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /shop/index.php [L]
</IfModule>


Save the file and check your website.

The “index.php” from Magento website url should be removed now.

Share

The founder of Design Tempest, Hamza Ghani is an eCommerce developer specialising in OpenCart development and Small Business Web Design, Hamza has worked with hundreds of businesses and runs his own company Xperteria which offers Web Design for small businesses, eCommerce Development, Internet Marketing and more. You can find him on and Twitter