Skip to content

Instantly share code, notes, and snippets.

@byjujohn
Last active April 8, 2022 04:03
Show Gist options
  • Save byjujohn/5508233 to your computer and use it in GitHub Desktop.
Save byjujohn/5508233 to your computer and use it in GitHub Desktop.
Magento: Programatically add custom URL Rewriting
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
ini_set('memory_limit', '32M');
set_time_limit (0);
require_once MAGENTO . '/app/Mage.php';
Mage::app();
Mage::getModel('core/url_rewrite')->setIsSystem(0)->setOptions('RP')->setIdPath('Imported-Old-Website-URL-test1')->setTargetPath('alicia-suspender-skirt-32360')->setRequestPath('SHOPONLINE.aspx?Product=Alicia Skirt&amp;Brand=Lascivious Test&amp;PID=1975')->save();
Mage::getModel('core/url_rewrite')->setIsSystem(0)->setOptions('RP')->setIdPath('Imported-Old-Website-URL-test2')->setTargetPath('alicia-suspender-skirt-32360')->setRequestPath('SHOPONLINE.aspx?Product=Alicia Skirt&Brand=Lascivious Test&PID=1975')->save();
/*
Mage::getModel('core/url_rewrite')
->setIsSystem(0)
->setStoreId($storeId)
->setOptions('RP')
->setIdPath('index.php?cat=c' . $categoryId . '_' . $this->strip($data['name']) . '.html')
->setTargetPath($categoryModel->getUrlPath() . '.html')
->setRequestPath('index.php?cat=c' . $categoryId . '_' . $this->strip($data['name']) . '.html')
->save();
*/
?>
@jsmageto
Copy link

jsmageto commented Jul 18, 2017

SHOPONLINE.aspx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment