Remote_host In .htaccess

An example from Apache URL rewrite guide:<br /><br />RewriteCond %{REMOTE_HOST} ^badhost\.mydomain\.com$<br />RewriteRule !^http://[^/.]\.****.* - [F]<br /><br />Nevermind what exactly it is doing. At least it can detect the hostname of the requester. I can't get it work. %{REMOTE_HOST} is always null. <br /><br />Similary PHP $_SERVER['REMOTE_HOST'] is null.<br /><br />In php I can revert to gethostbyaddr($_SERVER['REMOTE_ADDR'], what do I do in RewriteCond?<br /><br />By the way, can I access the rewrite log to ease debugging?<!--content-->
Hi,<br /><br />Without knowing exactley the end point your trying to achieve, I am not sure what you want from Remote_Host. The [F] Implies your trying to forbid a user though.<br /><br />Its not possible to access the Rewrite log. Sorry<br /><br />Jim<!--content-->
The [F] just happen to be in the manual example. I wanted to serve some JS files depending on country, and doesn't what to add .js to the list of php processed extensions.<br /><br />So my intention is:<br /><br />RewriteCond %{REMOTE_HOST} ^.*\.hk$<br />RewriteRule (.*)\.js hk$1.js [L]<br /><br />I quoted the example from the manual just to make sure I don't complicate the issue by making other mistakes unrelated to my inability to access the %{REMOTE_HOST}<!--content-->
 
Back
Top