Thu. Apr 24th, 2025

46. Magento. How to remove ‘index.php’ from the website URL

2 min read

‘Index.php’ can be successfully removed from the web-site URL only in case mod_rewrite module is enabled on your server. To check this, you may contact your server administrator/hosting provider.

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

1. Click the System->Configuration tab:

magento_how_to_remove_index_php_from_website_url_1

2. On the appeared screen click “Web” tab under “General” on the left hand side of your admin panel. You will see the below screen:
magento_how_to_remove_index_php_from_website_url_2

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:
magento_how_to_remove_index_php_from_website_url_3

5. Now we need to create an .htaccess file with the rewrite directives in the root of your Magento installation. You may use your hosting control panel File Manager or FTP to create a file.

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>

6. Save the file and check your website.

The ‘index.php’ is successfully removed from the URL.

This is the end of the tutorial, we have learnt how to remove ‘index.php’ from the website URL in Magento templates.

April 2025
M T W T F S S
« Jun    
 123456
78910111213
14151617181920
21222324252627
282930