Magento – How to Remove index.php from url address bar

Sunday, 20. November 2011

Here is how you can remove the index.php suffix from Magento URLs with ease!

This is also great thing to do for your SEO.

Log in to the backend and navigate to

System > Configuration > Web > Search Engines Optimization

Set Use Web Server Rewrites to YES.

Refresh cache management and you should be all set from here.

PS:
For others, you may also find useful to enable the RewriteBase from your .htaccess file. Never found this necessary though!

Enjoy.

Magento Multiple Store or Website Setup with Index.php

Wednesday, 14. September 2011

There are many ways to set up a multi-store or multi-website environment in Magento and make sure specific URL requests reaches the right website or store on Magento.

One popular way is to use the index.php file. Here are steps to do to get redirect URLs to associated stores or websites using this file.

Redirect URL to Magento’s website Code

1) Open index.php file

2) Search for the line below

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

3) Change it to

switch($_SERVER['HTTP_HOST']) {
	case 'domain.com':
	case 'www.domain.com':
		$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '<your_websitecode>';		
	break;
	default:
                $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
	break;	
}

4) Search for the line below

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

Make sure the type is says website and not store:

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';

Redirect URL to Magento’s Store Code

Repeat the same steps as above but make sure this time around you specify store codes in place of website code. Also, on step 4, set the type to store as opposed to website