- Log in to post comments
# create a new file ./getProductEn.php
<?php
require '../../app/Mage.php';
try {
$app = Mage::app('gb');
// check sku
$sku = $_GET['sku'];
if(!empty($sku)) {
// filter char in sku
$sku = preg_replace("/[^a-zA-Z0-9-\s]/", "", $sku);
// get product by sku
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
if($product != null) {
header('Location: '. $product->getProductUrl() . "?___store=gb");
}
}
} catch (Exception $e) {
Mage::printException($e);
}
?>
# modify .htaccess
RewriteRule ^en/(.*)$ /getProductEn.php?sku=$1 [L]