wilderness

msg:4049631 | 4:01 pm on Dec 26, 2009 (gmt 0) |
You need to insert an exception just above your closing line, else your going to get caught in a loop. RewriteCond %{REQUEST_URI} !^examplepage/index.php$ Additionally, I would suggest two things: 1) Denying access based solely on a solitary Class D range will come back to bite you in the backside (i. e. expand the Class D range). 2) You might explore multiple conditions based on both REMOTE_ADDR and USER_AGENT or REMOTE_ADDR and other criteria.
|
Dexie

msg:4049637 | 4:28 pm on Dec 26, 2009 (gmt 0) |
Thanks wilderness, how would the closing line look like, if it was for anyone from any of those IP address's viewing any page on websiteaddress.com please ?
|
wilderness

msg:4049639 | 4:33 pm on Dec 26, 2009 (gmt 0) |
| how would the closing line look like |
| what ever data is on http://www.example.com/examplepage/index.php as you've specified. [edited by: jdMorgan at 3:48 am (utc) on Dec. 27, 2009] [edit reason] example.com [/edit]
|
Dexie

msg:4049643 | 4:53 pm on Dec 26, 2009 (gmt 0) |
But where does : RewriteCond %{REQUEST_URI} !^examplepage/index.php$ come in ? Getting a tad lost.
|
wilderness

msg:4049651 | 4:59 pm on Dec 26, 2009 (gmt 0) |
It prevents a continuious loop (request) for the same page. 1)requested page 2) redirect to requested page 3) loop (absent exception) duplicates initial request again 4) and again and again, until your server time-outs.
|
Dexie

msg:4049653 | 5:10 pm on Dec 26, 2009 (gmt 0) |
Thanks, are we now saying that the complete code should read : RewriteEngine on RewriteCond %{REMOTE_ADDR} ^80\.xyz\.114\.34$ [OR] RewriteCond %{REMOTE_ADDR} ^81\.xyz\.221\.49$ [OR] RewriteCond %{REMOTE_ADDR} ^83\.xyz\.91\.24$ [OR] RewriteCond %{REMOTE_ADDR} ^86\.xyz\.156\.151$ RewriteCond %{REQUEST_URI} !^examplepage/index.php$ [edited by: jdMorgan at 3:48 am (utc) on Dec. 27, 2009] [edit reason] formatting [/edit]
|
wilderness

msg:4049659 | 5:24 pm on Dec 26, 2009 (gmt 0) |
| You need to insert an exception just above your closing line |
| RewriteEngine on RewriteCond %{REMOTE_ADDR} ^80\.xyz\.114\.34$ [OR] RewriteCond %{REMOTE_ADDR} ^81\.xyz\.221\.49$ [OR] RewriteCond %{REMOTE_ADDR} ^83\.xyz\.91\.24$ [OR] RewriteCond %{REMOTE_ADDR} ^86\.xyz\.156\.151$ RewriteCond %{REQUEST_URI} !^/examplepage/index.php$ RewriteRule ^(.*)$ http://www.example.com/examplepage/index.php [L] [edited by: jdMorgan at 3:47 am (utc) on Dec. 27, 2009] [edit reason] Example.com and fixed a typo. [/edit]
|
Dexie

msg:4050414 | 6:41 pm on Dec 28, 2009 (gmt 0) |
Many thanks wilderness, (and Jim for the formatting), that's solved that one. Bearing in mind what is needed in this scenario, is {REMOTE_ADDR} better than {REMOTE_HOST} please ?
|
jdMorgan

msg:4050647 | 5:08 am on Dec 29, 2009 (gmt 0) |
Those are two different things. REMOTE_ADDR is an IP address, taken from the TCP/IP stack for this incoming connection (i.e. no extra work involved). REMOTE_HOST is the result of your server issuing a reverse-DNS lookup request to the DNS system (which may be local to your host, or not) and getting the hostname to which that requesting IP address belongs. This requires the server (and the client) to wait while the DNS request is sent and serviced, and the response is sent back. In some cases, reverse-DNS lookups are not supported on a server, in which case REMOTE_HOST will return the original IP address unchanged. Best practices are to avoid reverse DNS lookups. If they can't be avoided entirely, then next-best is to only do them in limited circumstances -- for example, only for 'page' requests, and not for every image, stylesheet, external JavaScript file, favicon, object (etc.) referenced by those pages. If you do an rDNS lookup for every HTTP request and the traffic to your site grows, you can expect to have to upgrade your server so that it can handle all the extra work and all of the connections queued and waiting for rDNS lookups to complete. All these lookups can bring a busy site to its knees. Another thing to avoid is unnecessary file- and directory-exists checks, as in the unconditional, wasteful, and all-too-common code sequence:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST)FILENAME} !-d
Because these result in calls to the OS to go check the filesystem -- sometimes requiring a read of the physical disk. That and a few rDNS lookups can make for an awfully-slow server -- one reason why WP and Joomla with out-of-the box un-optimized .htaccess code don't 'scale' very well as traffic increases... Jim
|
Dexie

msg:4050733 | 11:23 am on Dec 29, 2009 (gmt 0) |
Thanks for the detailed reply Jim, will stick with the REMOTE_ADDR
|
|