My new wordpress site has to receive and then redirect a GET request from outside that has a name parameter appended in the request. "Name" is a reserved parameter in wordpress so when the request is received i get a 404.
old request: www_myweb_com/old_purchase?name=Michael&lastname=Smith
new address: www_myweb_com/new_purchase?firstname=Michael&lastname=Smith
The redirect is already solved with a plugin, but the big deal is how to replace that name parameter to firstname. Can anyone help me with this?
Thank you in advance.
Find
.htaccessfile at the root of your Wordpress directory, open it and add this AT THE TOP (above the pre-existing Wordpress rules):What this does:
www.myweb.com/old_purchase^name(.*)&(.*)among the URL querywww.myweb.com/old_purchase?name=...&lastname=...&others..matches this regex, and stores thenamevalue as a variable, and the rest of the query parameters as well)www.myweb.com/new_purchase?firstname=%1&%2where%1is the name value stored earlier, and%2are the rest of the query paramswww.myweb.com/new_purchase?firstname=...&lastname=...&others..NOTE: I'm a n00b at Apache and htaccess syntax and language, so this may not be the best solution. But it works :)