Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-07-01 08:32:14

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: non-htaccess redirect using pretext callback [SOLVED]

Bloke wrote #330846:

I wonder if a similar technique could be used to help Kjeld with his article list from custom fields conundrum? i.e. palm off /location/{something} to a form, whose content then does the appropriate <txp:article_(custom)> call to fetch the matching content to display.

Sure, one can redirect URLs to whatever needed. But I’m not a big fan of clean URLs: how would you translate location=Tokyo&period=Meiji? Messy URLs are much cleaner, in fact.

Offline

#14 2021-07-01 08:40:12

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: non-htaccess redirect using pretext callback [SOLVED]

jakob wrote #330841:

The ability to rewrite the parts of $pretext using the regular ‘pretext’ callback is already a fairly straightforward way to replace the humungous gbp_permanent_links with just a few lines of specific instructions.

There is also a more .htaccess-like pre-pretext way:

if (/* match condition here */) {
    $_SERVER['QUERY_STRING'] = 'f='.$matched_form;
    $_SERVER['REQUEST_URI'] = hu.'?'.$_SERVER['QUERY_STRING'];
}

Txp should do the rest. But at this stage $pretext is still empty, so ‘match condition’ must be based on $_SERVER array.

Offline

Board footer

Powered by FluxBB