I would like to redirect the user but first I need to manipulate the url by changing a string:
I Do it like this:
var url = location.href;
url=url.replace("featured", "list");
window.location.href=url;
But before I redirect the user, I also would like to change a get parameter of the url to a specific value. I read around here that it should be done like this:
//
location.search = jQuery.query.set("page", 1);
//
I just don't know how to combine both the string and the parameter manipulation before redirecting because the location search doesn't take my string replacement into account and because the string replacement doesn't take the location.search into account neither.
Basically, if the user is here: http://www.mysite.com/index.php?page=3&mode=featured
I would like him to be redirected to: http://www.mysite.com/index.php?page=1&mode=list
And this, whatever the page number he's in of course.
PS: I'm not trying to force the user to anything. My point is to use a data filtering system and if it's activated, the user should be in list mode and start from page 1. That's all.
Any help would be appreciated.