This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Rewrite of view parameter urls - Fails?
expandshrink

Rewrite of view parameter urls - Fails?

Rewrite of view parameter urls - Fails?

Tuesday 14 June 2011 8:41:48 pm - 3 replies

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/"blunk.gif Emoticon 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

Modified on Tuesday 14 June 2011 8:43:19 pm by JT -

Thursday 16 June 2011 3:42:56 pm

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.

Modified on Thursday 16 June 2011 3:47:52 pm by Thiago Campos Viana

Friday 24 June 2011 5:02:26 pm

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

Tuesday 11 June 2013 12:45:33 pm

It is possible.

But you should probably tell your boss that this kind of let'soptimize-the-site-for-blackmagick-SEO-guidelines-which-nobody-can-even-prove is just a waste of time. Producing better, fresh content gives usually a better payback.

Side note: you can create custom ezp module which gets all the parameters separated by slashes and generates the good url with parenthesis. It might be easier than using regexps. An examplem of such a thing is the layout/set view.

Modified on Tuesday 11 June 2013 12:46:26 pm by Gaetano Giunta

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from