Magento is a fantastic platform for selling online, arguably the best, but there’s one thing that has always left me frustrated as an SEO… That pesky index.php directory in the URL of ALL internal pages – nightmare!

SEO Friendly Magento URLs in Two Steps

Fortunately, whilst we were doing a Magento store for a client recently, I did a little bit of digging and found a pretty straightforward solution to the issue. It involves a couple of changes to the Magento admin settings and the addition, or modification, of a simple .htaccess file to sort out of the rewriting of the standard URLs.

Follow the simple steps below and you’ll be a step closer to SEO success with your own Magento store.

1) Let’s Change a Setting, Admin

The first thing you need to do is to login to your Magento admin panel (index.php/admin) in order to change a very simple setting which will let Magento know that you intend to use URL rewriting throughout your store.

Login, and change this setting:

1) Go to System > Configuration > Web > Search Engine Optimization

Use Web Server Rewrites: YES

That was easy, wasn’t it? Okay, now for the final step.

2) Let’s Use a .htaccess File to Rewrite the URLs

The final step involves creating a .htaccess in the Magento installation folder in order to compliment the settings you changed within your admin settings earlier, and this will actually rewrite the naughty URLs for you.

If your Magento store is installed in root (public_html), use this:

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

If your Magento store is installed in a subfolder (public_html/shop), use this:

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

You’re done – hope that helps!

It’ll definitely stop your SEO from pulling out his or her hair.

Let me know in the comments below if you use this or run into any issues!