Forum Moderators: phranque
RewriteCond %{REMOTE_ADDR} ^161\.127\.49\.104$
#RewriteCond %{REMOTE_HOST} ^http://apply.mysite.com/.*$ [NC]
#RewriteCond %{HTTP_REFERER} ^http://grommit.nam.nsroot.net/$ [NC]
RewriteRule ^.*$ /mypls/page2\.htm$1 [PT,L]
The second and the third option on the RewriteCond does not work...
No, there is no header available to indicate that the client has followed a redirect. However, if the redirect is from another page on your site, you could set a cookie or append a query string to the redirect target URL to identify it as a redirect.
Remote address: Visitor's IP address. Usually traceable to visitor's ISP.
Remote host: Visitor's hostname. Usually traceable to visitor's ISP.
HTTP referrer: URL of page where the link to your site was found. Does not include redirects.
Jim
I tried remote_host, information is not always found on this header variable.
I am confused of the remote_addr, is this the address of the original client or the address of the server that redirected initial request to our server.
http_referer, I came to know that you cannot use info. from this to code around rewrite logic...correct?
what I need to do is if a client is accessing
www.mysite.com or www.mysite.com/index.htm then I want to respond with index.htm (usual server response)
if client is accessing www.mysite.com from a redirect on another server (I know the host name of this server)
then I want to respond with index2.htm
Thanks
Umakanth
This is the IP address of the person clicking on the link.
There is no way to detect redirects from another server, unless that server uses a unique URL to redirect to your site. Then you might detect that unique URL and assume that it is a redirect from the other server. But you still can't be sure... Someone else may have copied the unique URL from that server to another page.
Detecting redirects is simply not supported by the HTTP protocol.
Jim
This is what I have and it is working, what do you think?
RewriteCond %{HTTP_REFERER} ^http://otherwebserver\.net/.*$ [NC]
RewriteRule .* /login2\.htm$1 [PT,L]
I am getting the result, that any request with
HTTP_REFERER has otherserver in it, go always to login2.htm
The reason I am asking you this question is that on the net there was a mention that http_referer works only 75% of the time...anything you have noticed.
Thanks
Umakanth
Your $1 is undefined, and should be blank. Again, I'm not sure why you are using it there.
HTTP_REFERER is dropped by many ISP (such as AOL) and corporate caching proxies, and is blocked by many users of Norton Internet Security and similar programs. In these cases, you cannot tell where the request was referred from, becuae the referrer will be blank.
Jim