Hannes P
Hannes P

Reputation: 21

Magento: Moved Multistore - new store always redirect to old domain, although new base_url

I have moved a Multistore to another webserver with the following structrue:

mystore.com --> Magento Multistore installation
flowers.website.com --> symlinks to mystore.com folder
cars.website.com --> symlinks to mystore.com folder

The new setup is completely the same (only different domains and folder names).

But if I go to the new url mynewstore.com I will always be redirect to the old domain. Things I have already done/tried:

The important part of my index.php:

/* 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';
$mageRunCode = 'mystore';
$mageRunType = 'website';
Mage::run($mageRunCode, $mageRunType);

If I'm going to change the $mageRunCode to another store ID (like "flowers"), the old (!!) flower store (redirect to old flower url) will be loaded.

I guess it is hard to solve the problem without looking at the code, but I've no other idea as to try it here. I really appreciate any hint.

Upvotes: 1

Views: 5872

Answers (3)

Giel Berkers
Giel Berkers

Reputation: 2960

I once had the same problem and it took me almost a whole day to figure out what was going wrong. I had a multistore but all the stores gave a 404 page on every URL I tried. In the end the solution was to change MAGE_RUN_TYPE from website to store.

Upvotes: 1

Nerjuz
Nerjuz

Reputation: 1061

in the index.php header add this:

$_SERVER['MAGE_RUN_CODE'] = $_SERVER['REDIRECT_MAGE_RUN_CODE'];
$_SERVER['MAGE_RUN_TYPE'] = $_SERVER['REDIRECT_MAGE_RUN_TYPE'];

Upvotes: -1

Axel
Axel

Reputation: 10772

Your index.php file as you have it is overriding the MAGE_RUN_CODE and MAGE_RUN_TYPE variables because of these lines:

$mageRunCode = 'mystore';
$mageRunType = 'website';

Since they are called after their initial definitions, they;re being reset to mystore and website.

Try removing these lines, and seeing if the variables are properly passed into the Mage::run() function.


Important Notice about CHMODing to 777.

This is a potentially dangerous thing to do as it can allow public access to your filesystem. You never want to set a 777 permission set on a production site for this reason.

Set your folders to 755 and files to 644. To do this, open a shell connection and cd to your Magento root directory. Run the following command:

chmod -R 755 *; find -type f -print0|xargs -0 chmod 644

If run correctly, all of the files in your Magento installation will be set to the correct permissions.

Upvotes: 0

Related Questions