alexfung Posted October 8, 2003 Posted October 8, 2003 An example from Apache URL rewrite guide: RewriteCond %{REMOTE_HOST} ^badhost\.mydomain\.com$ RewriteRule !^http://[^/.]\.****.* - [F] 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. Similary PHP $_SERVER['REMOTE_HOST'] is null. In php I can revert to gethostbyaddr($_SERVER['REMOTE_ADDR'], what do I do in RewriteCond? By the way, can I access the rewrite log to ease debugging? Quote
TCH-JimE Posted October 8, 2003 Posted October 8, 2003 (edited) Hi, 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. Its not possible to access the Rewrite log. Sorry Jim Edited October 8, 2003 by Jimuni Quote
alexfung Posted October 9, 2003 Author Posted October 9, 2003 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. So my intention is: RewriteCond %{REMOTE_HOST} ^.*\.hk$ RewriteRule (.*)\.js hk$1.js [L] 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} Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.