1
votes

For multi store setup in magento i have created a website name, store name and Store view name from configure->manage store like

store: de
name: de
code: de
website:de

and also changed base url for new created store form configure->web section and finally i have added these line in index.php after umask(0);

if ($_SERVER['HTTP_HOST'] == "localhost/project_name/de" || $_SERVER['HTTP_HOST'] == "http://localhost/project_name/de"){
$_SERVER["MAGE_RUN_CODE"] = "de";
$_SERVER["MAGE_RUN_TYPE"] = "de";
}

but when i am going to browse url http://localhost/project_name/de it is showing 404 error.

please give me a solution

thanks

4

4 Answers

1
votes

Did you copy index.php into new directory that you created? The modified code should be in new index.php.

Also, you should change Mage.php path in index.php file.

$mageFilename = '/root/directory/app/Mage.php';

And, did you put environment variables in /de folder .htaccess file :

SetEnvIf Host .*sitename.* MAGE_RUN_CODE=de
SetEnvIf Host .*sitename.* MAGE_RUN_TYPE=de

PS : change sitename with your domain name.

or just change sub directory index.php file as follows :

Mage::run($mageRunCode, $mageRunType); 

to

Mage::run('de', 'de'); 
1
votes

The $_SERVER['HTTP_HOST'] variable will only contain the domain name of your server (i.e. the contents of the Host header in the HTTP request), which is this case is localhost. If you want to set up a different store in a subdirectory, see this blog post for a .htaccess based solution for setting the mage run code.

1
votes

it`s very simple just copy two files in your magento root. and pased where you want (mysite.com) folder

That files are .htaccess.sample and index.php.sample

rename two files to .htaccess and index.php

open index.php and edit .

$mageFilename = MAGENTO_ROOT . '/app/Mage.php';

    to

$mageFilename = '/root/mysite/app/Mage.php';

Edit this two lines

/* Store or website code */ $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

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

if you set $mageRunType this as 'store' you must set $mageRunCode this as 'store code'

More detail available on

http://www.samdoit.com/news/magento-multi-store

0
votes

You may need to set System > Config > Web > Use Store Code in URL. Last time I tried to do this, it worked out of the box without having to touch index.php or an .htaccess