Forums / Install & configuration / Rewrite of view parameter urls - Fails?

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