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();

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 01:36:47
Script start
Timing: Jan 31 2025 01:36:47
Module start 'layout'
Timing: Jan 31 2025 01:36:47
Module start 'content'
Timing: Jan 31 2025 01:36:47
Module end 'content'
Timing: Jan 31 2025 01:36:47
Script end

Main resources:

Total runtime0.0203 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 588.2656151.2266
Module start 'layout' 0.00490.0038 739.4922220.7188
Module start 'content' 0.00870.0101 960.2109997.8516
Module end 'content' 0.01880.0015 1,958.062529.9922
Script end 0.0203  1,988.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002512.3816140.0002
Check MTime0.00115.2273140.0001
Mysql Total
Database connection0.00084.149910.0008
Mysqli_queries0.002512.547130.0008
Looping result0.00000.054010.0000
Template Total0.00115.310.0011
Template load0.00094.296610.0009
Template processing0.00020.969410.0002
Override
Cache load0.00063.066610.0006
General
dbfile0.00031.276980.0000
String conversion0.00000.029340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs