I've come across similar questions, such as this one, and found similar instructions on mod_rewrite tutorials.
I've determined that I need something along the lines of
RewriteRule ^(.*)<(.*)$ /$1$2 [L,R=301]
RewriteRule ^(.*)>(.*)$ /$1$2 [L,R=301]
This works for http://domain.com/<>
, but it does not work for http://domain.com?a=<>
I've also added the following, in my attempts to remove these characters from the query string:
RewriteCond %{QUERY_STRING} ^(.*)<(.*)$
RewriteRule ^(.*)$ /$1?%1%2 [L,R=301]
RewriteCond %{QUERY_STRING} ^(.*)>(.*)$
RewriteRule ^(.*)$ /$1?%1%2 [L,R=301]
This did not change anything. I've also tried escaping < and > in the regex as well (i.e. ^(.*)\<(.*)$
).
The end result that I am trying to achieve is to have
http://domain.com/<whatever>
turn into http://domain.com/whatever
, and
http://domain.com/a=<whatever>&b=whatever
turn into http://domain.com/a=whatever&b=whatever