PHP rewrite url rules for custom search url to output without parameters
-
Hello,
We are trying to get some custom search links with parameters to not include the parameters and output as a ‘pretty url’.
(the search page returns villas that are in a specific region (category)
We would like this:
/villa_rental_italy?region=regions-venetiato look like this:
/villa_rental_italy/region/regions-venetia (or simillar)We have tried (and various variants) of this:
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
function create_new_url_querystring() { add_rewrite_rule( '^villa_rental_italy/region/([^/]*)$', 'villa_rental_italy?region=regions-venetia&search=region', #'index.php?region=$1&search=region=$matches[1]', 'top' ); add_rewrite_tag('%villa_rental_italy%','([^/]*)'); //flush_rewrite_rules(); } add_action('init', 'create_new_url_querystring');
which hasnt worked, any input would be greatly appreciated.
many thanks Sam
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP rewrite url rules for custom search url to output without parameters’ is closed to new replies.