Reputation: 478
If I have a 3rd party solution that sends all links to one test stack and I want to redirect those clicks back to the stack being tested, how can I get the host from %{HTTP_REFERER} so that I can load the requested page on the correct test stack. Example, QA is testing testweb4 but third party solution always points to testweb5 regardless of which test stack it is running on. So I want .htaccess on testweb5 to temporary redirect to requested page on referrer when referrer is one of our test stacks but not testweb5.
Upvotes: 1
Views: 83
Reputation:
You could do something like this:
RewriteCond %{HTTP_REFERER} ^(http://testweb(?:1|2|3|4))/
RewriteRule ^ %1%{REQUEST_URI} [NE,R,L]
But this is not reliable, since the referrer is not always sent. However, it's what you asked for, perhaps it will do the job for you since it's just testing.
Upvotes: 1