You are here:  » Replace plus by dashes

Replace plus by dashes

Submitted by affinity-group on Mon, 2016-01-04 13:03 in

Hi there,

I am currently trying to replace the + sign by an hyphen (-) in the URLs for brands, categories and merchants but can not get it to work.

I rewrote the urls for categories, merchants and brands and want to approach them like:

instead of

How can I achieve this?

I rewrite using the following rewriterule (where catalogus is the container permalink):
RewriteRule ^brand/(.*)$ catalogus/?brand[]=$1&pagename=catalogus&%{QUERY_STRING} [NC,L]

Hope you can help me out!

Kind regards,

Robin L

Submitted by support on Mon, 2016-01-04 13:25

Hello Robin and welcome to the forum!

You should be able to set-up the desired base HREF rewrite URLs through the plugin configuration (/wp-admin/ > Settings > without the need to create additional RewriteRule entries, and by default the entry values are hyphenated rather then being left as spaces, which is by way of this code at line 120 of the plugin file pto_atoz.php:

  $itemURL = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($row->$module);

However, I see that you have made modifications to support multiple entry values by passing the items in as an array variable indicated by the [] of brand[] so it may be that you just need to use the same pto_common_hyphenate() function around the merchant / category / brand name being used to generate the URL in your code.

That should be all it is, if you're still not sure let me know and I'll check it out further with you...


Submitted by affinity-group on Mon, 2016-01-04 13:47

Hi David,

Thank you for your quick reply and sorry for posting this topic twice.

I think I got it working now, I have made custom search filters for brand/categories et cetera, but it passed the dashes directly in the query. String replacing the dashes by spaces did the trick!

Thanks again for your time!