Reputation: 1746
I want to redirect a user via htaccess when a specific HTTP_REFERRER is set. Here is my current htaccess
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^(.*)\.example.org [NC]
RewriteRule ^(.*)$ https://example.com/blocked/$1 [L,R]
The problem I am facing now is that the HTTP_REFERRER still persists and I end within an endles redirection to /blocked/blocked/blocked
Is there any easy way to simple redirect/forward the user just ones to /blocked?
Upvotes: 2
Views: 90
Reputation: 41219
You need to exclude the /blocked
URI in Rewrite to avoid the loop error
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^(.*)\.example.org [NC]
RewriteCond %{REQUEST_URI} !/blocked
RewriteRule ^(.*)$ https://example.com/blocked/$1 [L,R]
Upvotes: 2