php - Multiple Magento 1.9 Websites/Stores on same domain -
i need create separate retail , wholesale stores , plan on same domain using url structure mysite.com/store , site.com/wholesale.
i have created separate websites in magento backend , entered relevant unsecure/secure base urls. mysite.com/store working great , showing products etc... if go mysite.com/wholesale standard server 404 (as opposed magento 404).
how set correctly? need 'wholesale' folder in root directory or make changes .htaccess in magento root or similar?
every tutorial or question on or magento.stackexchange seem based on separate stores on different domains / subdomains.
in order use separate folders different stores under same domain name can use relativly new "add store code urls"-option.
you can find otion under system > configuration > web > url options
. core_config
path web/url/use_store
.
to make use of option should
- use same base-url stores (no need add
/wholesale
folder base url) - set store code same name have subfolder of base url (e.g. "wholesale")
this works independent of web server using. no change .htaccess files required.
if want name website folder different store code have create folder , add custom index.php
sets correct store code:
<?php /** * error reporting */ if (isset($_server['mage_is_developer_mode'])) { error_reporting(e_all | e_strict); ini_set("display_errors", 1); ini_set("log_errors", 1); } else { error_reporting(e_error); ini_set("display_errors", 0); ini_set("log_errors", 1); } /** * compilation includes configuration file */ define('magento_root', dirname(getcwd())); $compilerconfig = magento_root . '/includes/config.php'; if (file_exists($compilerconfig)) { include $compilerconfig; } $magefilename = magento_root . '/app/mage.php'; $maintenancefile = 'maintenance.flag'; php_dir('downloader')) { header("location: downloader"); } else { echo $magefilename." not found"; } exit; } if (file_exists($maintenancefile)) { include_once dirname(__file__) . '/errors/503.php'; exit; } require_once $magefilename; /** * enable developer mode */ if (isset($_server['mage_is_developer_mode'])) { mage::setisdevelopermode(true); } umask(0); mage::run('wholesale', 'store');
there no changes default index.php except 2 locations
- you must tell magento real root is:
define('magento_root', dirname(getcwd()));
- and must specify store code:
mage::run('wholesale', 'store');
all other lines standard magento.
theoretically should able accomplish same rewrite rules, have never got work properly.
Comments
Post a Comment