Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Edit: I had a chance to play with my htaccess file and I did figure out a solution that I have appended below. Long story short though, I wouldn't use it even though it seems to work.</p> <p><strong>Original:</strong></p> <p>You can try not redirecting if you have already redirected by adding the REDIRECT_STATUS check:</p> <pre><code>RewriteEngine On # redirect to landing page RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 // my real IP would go here RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteCond %{REQUEST_URI} !/UpdatePage.html$ [NC] // stop infinite loops on itself RewriteRule .* /UpdatePage.html [R=302,L] </code></pre> <p>From what I understand this would mean: redirect to the UpdatePage.html if the remote address is a certain IP address and it has not been redirected before.</p> <p>I'm unable to check whether this will result in the desired behaviour, but I did get this from the answer on this SO question: <a href="https://stackoverflow.com/questions/499068/clean-url-redirect-loop">Clean URL Redirect Loop</a>. </p> <p><strong>Tested solution:</strong></p> <p>I played around with my WAMP setup and came up with this:</p> <pre><code>RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 // my real IP would go here RewriteCond %{REQUEST_URI} !/UpdatePage.html$ [NC] // stop infinite loops on itself RewriteCond %{REQUEST_URI} ^(.+)\.html$ [NC] // Only handle html pages RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^(.+)\.html$ [NC] //don't redirect if the referer is a page. Should actually include the domain as well RewriteRule .* /UpdatePage.html [R=302,L] </code></pre> <p>The first time to any html page in the site should redirect to the UpdatePage then the user would click a link on that page and will go to the original page. The referer environment variable is then set and you can check if it is valid and then not redirect.</p> <p>This does not handle going to the root of the website. The user must be loading an html page directly.</p> <p>I much prefer your solution (@james). Coding the logic into the top of the main gateway PHP page is simpler and far less error prone, but I figured I would try to find a way using htaccess :-). Please note that I would never use this particular htaccess method myself.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload