How to ignore cHash when working with urls that contain an id?

268 Views Asked by At

The website that I'm working on uses cooluri to format the urls. In the case of news, the "parameters" column of the "link_cache" table stores the parameters like this:

a:3:{s:5:"cHash";s:32:"eea2db734d63b661abaab43d86fd3bb5";s:2:"id";s:5:"15503";s:18:"tx_ttnews[tt_news]";s:6:"142085";}

, or in a more readable way:

{  
   "cHash":"eea2db734d63b661abaab43d86fd3bb5",
   "id":"15503",
   "tx_ttnews[tt_news]":"142085"
}

My problem is, that there are lots of pages where these urls are inserted in content elements like in the example below, and ofcourse the cHash parameters don't match.

website.com/news/some-title/431731b3f9d391a54c9ee48467ca4bb4.html

Now because of this I get the following error message on the news single view page:

no news_id given

Is there a clean way to solve this issue? I was told that changing the links in the backend is not an option. Also, the links are very old, and the option "oldlinksvalidfor" is set to 365.

1

There are 1 best solutions below

0
Geee On

Your configuration goes in the block. Here is a configuration for Ext:CoolUri. This working fine for me (with tt_news) this will remove cHash from the URL. You have an additional configuration for managing caching and all.

<predefinedparts>
    <part>
        <parameter>no_cache</parameter>
    </part>
    <part>
        <parameter>cHash</parameter>
    </part>

<!-- common patterns -->

<!-- parts defined this way will be removed from URL -->
<part>
    <parameter>paramC</parameter>
</part>
<!-- this will prefix a value with "prefix-". Cannot be localized.
-->
<part key="prefix-(.*)" regexp="1">
    <parameter>paramD</parameter>
</part>

<part key="page-(.*)" regexp="1">
    <parameter>array[k5]</parameter>
</part>
<!-- if parameter matches value, key will be added to URL 
with mutliple values, use valuemaps
-->
<part key="thisWillAppearInUrl">
    <parameter>paramE</parameter>
    <value>ifParamEMatcesThisValue</value>
</part>
</predefinedparts>

Hope this will helpful to you.

Greetings!