Forums / Developer / SOLVED: Migration to eZP: url migration problem

SOLVED: Migration to eZP: url migration problem

Author Message

Andrey Astakhov

Thursday 25 October 2007 4:38:15 am

We make migration of php+mysql web site to eZ Publish, but we had a problem while organizing redirection through 310 redirect of old urls into new via system means.

I have old urls like http://site.com/12/55/67899
and new nice urls like http://site.com/url_alias

We've tried:

$urlAlias = eZUrlAlias::create( '12/55/67899' , 'url_alias', false);
$urlAlias->store();

but it doesn't work: we have 404 error "Module url_alias not found".

What is the best way to organize such url redirection?

Andrey Astakhov

Friday 26 October 2007 4:14:53 am

Solution:

$systemUrlAlias = ezUrlAlias::fetchBySourceURL( 'url_alias' );
$urlAlias = eZUrlAlias::create('12/55/67899' , 'url_alias', false, $systemUrlAlias->attribute( 'id' ) 
$urlAlias->store();