Our main site is on WordPress. We have external links coming in with various query string parameters. Unfortunately, some of these interfere with WordPress (eg 's' is reserved).
I would like to setup rewrite rules with htaccess since that is how I am already doing some things for the site. My issue is that I need to REPLACE the query string parameters with new names so they are not conflicting.
Possible Parameters and Mapping:
'l' -> 'li'
's' -> 'si'
'g' -> 'gi'
'i' -> 'ii'
These can come in any order but basically need to be replaced with the above mapping. An example:
FROM http://www.domain.com/register?l=something&s=something (order not predictable)
In your htaccess file before any rules you already have, add these:
RewriteCond %{QUERY_STRING} ^(.*&)?s=(.*)$
RewriteRule ^(.*)$ /$1?%1si=%2 [L]
RewriteCond %{QUERY_STRING} ^(.*&)?l=(.*)$
RewriteRule ^(.*)$ /$1?%1li=%2 [L]
RewriteCond %{QUERY_STRING} ^(.*&)?g=(.*)$
RewriteRule ^(.*)$ /$1?%1gi=%2 [L]
RewriteCond %{QUERY_STRING} ^(.*&)?i=(.*)$
RewriteRule ^(.*)$ /$1?%1ii=%2 [L]
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.