How to remove index.php form url in magento


Hi, if you are using Magento and your store urls are looking this way,

http://www.cmsblogheart.com/index.php/how-to-remove-index-php-form-url-in-magento.html<br>

So, you must be looking , how to remove that index.php from the middle, as thats not good for Search Engine Indexing at all. So, here is the trick.

1. Goto your site root folder and you can find the .htaccess file. Just edit that. Open it on a text editor and find this line,

  #Rewrite Base /magento/ . 
     Just replace it with
 Rewrite Base / .

Put the following code in the .htaccess

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


2. Then goto your Admin Panel and enable the Web Server Rewrites. You can find it at System > Configuration > Web > Search Engine Optimization.

Now set the “Use Web Server Rewrites” option under “Search Engines Optiomization” to “Yes”.

3. Then, set the “Use Secure URLs in Frontend” option under “Secure” to “Yes”. Click “Save Config” button in the top right:

4. Then goto your Cache Management page ( System > Cache Management) and refresh your Cache and also refresh the Web Redirects.

Thats all. Test at Frontend now.

Leave a comment