Apache Redirect for Internal Traffic Only

Apache Redirect for Internal Traffic Only - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Apache Redirect for Internal Traffic Only error on your web browser. Problem :


We have a page, gateway.school.edu, where users have to fill out a recaptcha before being directed forward to our password reset. I would like any internal traffic, any user agent on our network with a 10., 172. or 192.* IP, to get passed through without having to fill out the recaptcha. So an internal user would navigate to gateway.school.edu, where apache would check for an internal IP, then send them on to reset.school.edu. External users would have to fill out the captcha before being sent to reset.school.edu



Is this possible using REMOTE_ADDR in apache? Something like:



#gateway.school.edu virtual host
RewriteCond %REMOTE_ADDR ^192.*
RewriteRule .* reset.school.edu


Is there another approach I could take to accomplish this, or would a rewrite be the best way? Syntactically, how do I define the IP ranges?


Solution :

Try this:



#gateway.school.edu virtual host
RewriteCond %REMOTE_ADDR ^10.(.*)$ [OR]
RewriteCond %REMOTE_ADDR ^172.(.*)$ [OR]
RewriteCond %REMOTE_ADDR ^192.(.*)$
RewriteRule .* reset.school.edu [R=301,L]


The .* is a wildcard. The escapes the . which anchors the match allowing it to be taken literally. The () may not be necessary- it is usually used to capture the value of the regular expression match into a variable. You may be able to remove them, but I left them for this example for the sake of readability. The ^ matches the beginning of the line. The $ matches the end of the line. The [OR] is obvious. The [R=301,L] is a redirect 301 and last.


We hope that this article has helped you resolve the redirects, apache, mod-rewrite error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=