Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Can I block people from viewing my site based on their IP address?

Posted on 2009-02-22
Medium Priority
Last Modified: 2012-08-14
Is there a way to block certain IP addresses from accessing my site?
Question by:elliottbenzle

Expert Comment

by:Ken Fayal
ID: 23706436
Are you asking if you can do this from code or from the web server itself?
LVL 15

Expert Comment

ID: 23706438
Add the public IP address to your firewall.
LVL 10

Expert Comment

by:Andrew Doades
ID: 23706464
simple, add this line to your .htacces file

deny from

of course add your own ip address

Accepted Solution

Dirtpatch-Jenkins earned 2000 total points
ID: 23706471
To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-

    order allow,deny
    deny from
    allow from all

If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-

    order allow,deny
    deny from
    deny from
    deny from
    allow from all

You can even block a network range ip using .htaccess:-

    order allow,deny
    deny from 129.0.0
    allow from all

to use htacces the server must be running apache

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question