2

How can i add bulk URL Rewrite Management, i need to migrate new website, but i have already promoted my old site products, so, after i change new site, old site url return blank page, or empty page. So i have add all my old site url into new site request path, my target path is my new site products url. so i have no problem after change my site.

1 Answer 1

2

You can export URL structure and create a .php file in root of magento with below code.

<?php
$pageurl['http://oldsiteurl/']='http://newsiteurl/';
$pageurl['http://oldsiteurl/']='http://newsiteurl/';
$pageurl['http://oldsiteurl/']='http://newsiteurl/';
$pageurl['http://oldsiteurl/']='http://newsiteurl/';

$current_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if(array_key_exists($current_url, $pageurl))
{    
    $redirect_url = $pageurl[$current_url];
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $redirect_url"); 
    exit;   
} 

Include above .php file in index.php to redirect them on new website. .

3
  • make sure above only change in request path not in target path
    – Gem
    Sep 21, 2016 at 10:42
  • 1
    This is a core script. You just need to prepare your array according to your changes in URLs. Sep 21, 2016 at 10:50
  • bro, i need just bulk add url rewrite management. so how can i add bulk url rewrite
    – Gem
    Sep 22, 2016 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.