Remove index.php from the URL in Magento

Originally published on Tuesday, 25 June 2013 17:05

By default, Magento adds index.php into the URLs for the store front. This is generally regarded to have an adverse effect on the Search Engine Optimisation (SEO) of the site. There are many posts around that try to explain how to change the URL from

http://www.mydomain.com/index.php/category.html

to

http://www.mydomain.com/category.html

The following method worked on a number of sites successfully for us on different hosts.

The first step is to log in the site admin and turn on Web Server Rewrites.

In the system menu: General > Web > Search Engine Optimisation. Change ‘Use Web Server Rewrites’ to Yes

In the site webspace root the .htaccess file will next need to be edited:

About half way down the file the following line can be found:

############################################
## you can put here your magento root folder
## path relative to web root

#RewriteBase /Magento/

############################################

Change #RewriteBase /Magento/ to RewriteBase / (Note the #)

Flush the Magento cache (System > Cache Management in admin)

Check the front end, the index.php in the URL will have been removed.