Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Blocking IPs with an image and htaccess?

7:55 am on Mar 2, 2007 (gmt 0)

New User

10+ Year Member

joined:Mar 2, 2007
votes: 0

I want to be able to block certain IP addresses from viewing a webpage. The problem is that for this particular webpage (site A), only html is allowed. I don't know of any way to block IPs by using html. I thought maybe I could create a rule in htaccess on another website (site B) that would allow me to block the IPs on site A.

I've already created something in htaccess that allows me to track IPs on site A by putting an image on the webpage. Is there a way to block users from the webpage by inserting an image on the webpage? From what I already tried, only the image is affected, not the webpage. It doesn't seem like it's even possible but I was hoping someone would know for sure.

2:39 pm on Mar 2, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 29, 2002
votes: 0

If you have access control over site B but not site A -- make the content you want to restrict come from site B -- you can do this by using either iFrames or JavaScript codes on site A to include content that will be retrieved from site B and this be subject to any .htaccess rules you set up on site B. JavaScript would be more transparent than iFrames because if the SCRIPT SRC tag ref is denied, the browser will just show nothing, opposed to to an iFrame SRC which will display the error (you can tweak both with a redirect though).

On site B, the .htaccess code can also just redirect the "good" visitors to the good content on site A and redirect the "bad" ones to something else on site A or B, or anywhere else.

4:39 am on Mar 3, 2007 (gmt 0)

New User

10+ Year Member

joined:Mar 2, 2007
votes: 0

It seems that the script and iframe tags are not allowed on site A. Something else that I was going to try was to create an external stylesheet located on site B and link to it from site A. But site A doesn't allow the link, import, or meta tags.
6:51 pm on Mar 3, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wilderness is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 11, 2001
votes: 3

The best solution is to ditch "Site A" and get consign an effective host without restrictions.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members