Blog  ›  The Dreaded index.php!

The Dreaded index.php!

February 29, 2012

A lot of people get the very annoying problem in Magento where “index.php” shows up in their URLs. If you try to type in “store.com” the page will load as “store.com/index.php”. This happens on sub-pages too; if you go to a product or category you’ll see “store.com/index.php/widgets/gizmo.html”.

The solution for this problem can be tricky. There are a number of factors that contribute to how your domain is displayed in Magento and you need to make sure everything is configured properly. The settings to check for include…

Apache mod_rewrite

99% of all Magento installations run on the Linux powered Apache Web Server. Apache includes a module called “mod_rewrite” which allows an installed application to rewrite the URLs that will be requested by visitors. This feature is generally installed and enabled by default, but you should confirm this if you’re seeing index.php in your URLs.

Magento Web Server Rewrites

Go into your Magento admin and navigate to System > Configuration > Web > Search Engine Optimization > Use Web Server Rewrites and make sure the option is set to “enable”.

.htaccess AllowOverride_All and RewriteBase

On your server you should find an important file labeled “.htaccess“. This file controls certain aspects of how your site is displayed, loaded, and interacted with. You want to make sure you have two lines in this file and that neither is preceded with a “#” (which is a way of commenting out a line of code from being active). Open up this file and make sure that AllowOverride_All is present and that RewriteBase is both present and followed by the directory where you have Magento installed (i.e. “/” for a root directory installation or something like “/store/” if you site is set up at exmample.com/store).

One other thing to note, your server can have multiple .htaccess files depending on how Apache was installed and configured. Do a search on your system to make sure that any other .htaccess files (sometimes found in various subdirectories)  have the above settings as well.

Resolution!

Remember to clear the cache from Magento and your browser as well as restart Apache to ensure all your changes have taken effect and you should hopefully be free of index.php!

The Commative Team


Thanks for reading! Make sure to grab the feed and follow us on Twitter.

2 Comments


  1. Very good site you have here but I was curious about if you knew of any message boards that cover the same topics discussed here? I’d really love to be a part of community where I can get feedback from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Thank you!

    • Support says:

      Hey Grazyna,

      Aside from this site, you may want to try MagentoExpert.com. That’s a similar site in that the message board is people asking and answering various questions related to Magento.

      Thanks,
      Support


Question? Comment? This is the place:

You can use these HTML tags: <a href="" title=""> <b> <cite> <code> <em> <strike> <strong>