Welcome to WebmasterWorld Guest from 126.96.36.199
1. I cannot use REWRITE as Frontpage Extensions are affected.
2. $1?XYZ is not important in this example.
3. Though a newbie at regexs my experiments work as intended UNTIL I add ?anything at the end of a URL.
4. The object of the exercise is to know when a URL has certain 'tracking' information on the end.
5. My URL in question is on many many sites throughout the web so I cannot change it.
I'll give you an example that works WITHOUT the ?ABC.
RedirectMatch (.*)PageOne.htm$ $1PageTwo.htm
in the .htaccess file within the Test directory.
This works fine, 100%, I just did it now.
RedirectMatch (.*)PageOne.htm?ABC$ $1PageTwo?XYZ.htm
NO redirection takes place as the PageOne.htm?ABC
is not matched at the end of the string.
No matter how I fiddle with (.*)PageOne.htm?ABC$
I cannot get a match.
As I said originally this is very important for me to resolve as I have an important URL in cyberspace that I urgently need to redirect.
This is because the ?ABC is now in your environment as the QUERY_STRING. It is not considered part of the URL in the redirect match.
If you're wanting to change the environment, you might consider a combination of redirectMatch (or mod_rewrite) and the SetEnvIf directive.
I've tried to set QUERY_STRING to something else based on certain conditions and the server will not let me modify it. It will let me set my own variables otherwise. Sorry if this caused you to waste some time, but the bottom line is that I don't think you can change ABC to XYZ in the Query String.
Thanks for your effort. When I started this exercise I didn't know that ?ABC is not considered part of the URL and so is not parsed.
I also did not know that it was called the QUERY_STRING.
Is it possible, in the .htaccess file to perform an IF...THEN...ELSE.
IF QUERY_STRING = "?ABC" THEN
or something like that.
I'm a kind of a puzzle person, so I worked on this for quite a while yesterday.
AFAIK, there is only one way: mod_rewite. And then I looked up the problems with FP extensions and so I know what you mean.
I'm glad you asked, though, because I did have a couple of other questions.
Is ?ABC ALWAYS the query? or are there others?
Because this will work:
redirect /Test/PageOne.htm [Test...]
Thereby ignoring the first tracking code.
I'd have to know more about what the circumstances are.
that should read:
redirect /Test/PageOne.htm [mysite.com...]