爲了在同一域名下的不同商店中使用單獨的文件夾,您可以使用相對新的「向店鋪添加店鋪代碼」選項。
你可以在System > Configuration > Web > Url Options
找到這個otion。 core_config
路徑是web/url/use_store
。
要使用這個選項,你應該
- 使用相同的基本網址商店(無需在
/wholesale
文件夾添加到基礎URL)
- 設置商店代碼與您希望作爲您的基本網址的子文件夾具有相同的名稱(例如「批發」)
這種方式獨立於您正在使用的網絡服務器。所以不需要更改任何.htaccess文件。
如果你想命名的網站文件夾的東西比你的店的代碼不同,你必須創建該文件夾和一個自定義index.php
添加它,設置正確的存儲代碼:
<?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." was 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');
有幾乎沒有,除了兩個位置
從默認的index.php變化
- 你必須告訴Magento的地方它的真正根源是:
define('MAGENTO_ROOT', dirname(getcwd()));
- 你必須指定店鋪代碼:
Mage::run('wholesale', 'store');
所有其他行都是標準的Magento。
理論上你應該也可以用重寫規則完成同樣的工作,但是我從來沒有這樣做過。
我正在使用Apache網絡服務器。 – Mark