Don't apply rules if redirect happened before

50 Views Asked by At

I'd like to stop Apache from applying rules if the user has been redirected before:

Example:

Redirect 301 /foo/bar.php https://example.org/foo/bar

## Don't apply this if the user has been redirected using the 301 above
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/$ index.php?foo=$1 <-- I don't want to add the parameters here, if the user has been redirected

So far I was thinking about checking a status using SetEnvIf, but this does not even match here:

SetEnvIf Referer "^$" local_referal=1

RewriteCond %{ENV:local_referral} 1
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]
0

There are 0 best solutions below