I have a URL like so:
I'm trying to remove the following query variable from the query string in the URL IP=169%2E59%2E201%2E137 while leaving the rest of the string intact. That variable is an IP address which may be a different IP address each time, but will always be an IP. One of the CMS systems I use will error out if an IP address is found in the query string for security reasons. Unfortunately, I need to get data sent from a payment gateway, and there's no way at the gateway to turn off the IP address that's being sent from them. If I'm to capture data sent to my CMS, then I need to have the IP in the query removed or replaced using HTACCESS.
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /.*\ HTTP/ [NC]
RewriteCond %{QUERY_STRING} IP= [NC]
RewriteCond %{QUERY_STRING} (.*)(IP=[0-9]{1,3}%252E[0-9]{1,3}%252E[0-9]{1,3}%252E[0-9]{1,3})(.*) [NC]
RewriteRule .* %{REQUEST_URI}?%1%3 [R=301,L]
So, I started writing something like this, but honestly I suck at mod_rewrite, and regular expressions.
I don't care if it's set to IP=123, or just removed, but it can't be formatted as an IP. Please let me know if you can help!