I'm going nuts trying to figure out how to replace a querystring url in Magento from using the + sign to using a dash (-) between words. I purchased an awesome extension from fishpig: http://fishpig.co.uk/magento/extensions/seo-search-urls/
But I have not been able to get it to work. Ben (the code) has been working with me to try to get the functionality going, but I'm trying to be a bit proactive.
It seems to me that the problem lies in a .replace section in his code.
var value = fld.getValue()
.toLowerCase()
.replace(/^\s+|\s+$/g, '')
.replace(' ', ' ');
All my search urls still have /this+word/ instead of /this-word/ but I don't see where in the .replace the change from the + to the - dash should occur.
You should escape + with backslash
var string="some+thing+in+my+closet";
alert(string.replace(/\+/g,"-"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.