Hello,
I have a situation where I am trying to use Apache's RedirectMatch directive to redirect all users to a HTTPS URL except a single (Linux) user accessing there own webspace. I have found a piece of regular expression code that negates the username:
^((?!andy).)*$
but when I try using it in the directive:
RedirectMatch ^((?!andy).)*$ https://www.example.com/
the URL:
http://www.example.com/~andy/
still gets redirected to the HTTPS URL:
https://www.example.com/
Also if I comment out the line:
# RedirectMatch ^((?!andy).)*$ https://www.example.com/
and restart Apache, and then try the URL:
http://www.example.com/andy
I get a 404 response, which is expected. But, if I try the URL:
http://www.example.com/~andy
The redirect is triggered and I am redirected to:
https://www.example.com/
and as I said, the redirect is commented out and I have restarted the server. How can this happen? So this is not just a regex thing, it seems Apache is redirecting without instruction!
I am not an expert in regular expressions (or Apache), so any help in getting this working would be greatly appreciated.
Thanks,
Stephen