rajmohan
rajmohan

Reputation: 1618

ERR_TOO_MANY_REDIRECTS htaccess HTTP_REFERER redirect rule

I have many redirect rules in my .htaccess file. All are working fine but when I tried to implement htaccess rule using http_referer browser is showing ERR_TOO_MANY_REDIRECTS message during the redirect. Redirect is working fine.

Here is what I am trying. We have an external site
https://www.abcd.com in which there is a link https://www.xyz1.com/de/TestPass. But it should redirect to
https://www.xyz1.com/de/TestPass?agency=abcd not to
https://www.xyz1.com/de/TestPass

I have tried as shown below:

RewriteCond %{HTTP_REFERER} ^https://www.abcd.com [NC]
RewriteRule ^(.*)$ https://www.xyz1.com/de/TestPass?agency=abcd[L,R=301]

Please help.

Thanks, Raj

Upvotes: 0

Views: 219

Answers (1)

Rich Bowen
Rich Bowen

Reputation: 5892

Before the RewriteRule add

RewriteCond %{QUERY_STRING} !agency

That will avoid the looping.

Upvotes: 1

Related Questions