Rewrite of view parameter urls - Fails?

Author Message

JT -

Tuesday 14 June 2011 11:41:48 am

Hi!

 

I need to set up our Apache to rewrite a page parametrized by view parameters so that the view parameters are more "user friendly":

http://www.example.com/path1/path2/page/(key1)/value1/(key2)/value2

should become

http://www.example.com/path1/path2/page/key1-value1/key2-value2/

 

(Obviously it's not shorter or simpler but my boss thinks it is better for search engines.)

It is no problem to define the rewrites. But when I try to access the page via the ".../page/key1-value1/key2-value2/"-variant I get an module not found error.

I can get it to work by using the rewrite rule redirect option [R]. But that is not sensible because the rewrite should be invisible/unrecognizable to/by users or other systems.

Looking at the Apache rewrite log I see that the substitution is performed perfectly ok with and without the [R] redirect option.

What is happening? Who can give me a hint?

I think it is related to the usage of path_info components (eZ Publish complains about the path "/path1/path2/page/key1-value1/key2-value2/") which are not altered without a actual rewrite.

Can one give me an advice how to get around that problem in the rewriterule without using the redirect options?

 

Thanks in advance

 

JT

Thiago Campos Viana

Thursday 16 June 2011 6:42:56 am

I think it will not be possible because how could ez knows that /page/key1-value1/key2-value2/ is not a url path for some content, when we put '(' and ')' like in (key1)/value1/(key2)/value2 we are telling ez publish that it is not a path to some content but a named parameter.

Maybe the only way to do it is creating a url alias foreach url you need, never tried.

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Martin Weber

Friday 24 June 2011 8:02:26 am

I think this should work. You have to make a regular expression and add an identifier to the requested url so the internal rewriting can be done to urls the ez core needs to handle.

 

Regards,

Martin

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 29 2025 23:48:55
Script start
Timing: Jan 29 2025 23:48:55
Module start 'layout'
Timing: Jan 29 2025 23:48:55
Module start 'content'
Timing: Jan 29 2025 23:48:55
Module end 'content'
Timing: Jan 29 2025 23:48:55
Script end

Main resources:

Total runtime0.0127 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.2578151.2266
Module start 'layout' 0.00450.0024 739.484436.6875
Module start 'content' 0.00690.0043 776.171990.2031
Module end 'content' 0.01120.0014 866.375033.9766
Script end 0.0126  900.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002519.5147140.0002
Check MTime0.00119.0575140.0001
Mysql Total
Database connection0.00065.033610.0006
Mysqli_queries0.002015.871430.0007
Looping result0.00000.109310.0000
Template Total0.00118.410.0011
Template load0.00086.678210.0008
Template processing0.00021.642710.0002
Override
Cache load0.00064.724710.0006
General
dbfile0.00032.181580.0000
String conversion0.00000.045240.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