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

x
?
Solved

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

Posted on 2009-02-22
4
Medium Priority
?
260 Views
Last Modified: 2012-08-14
Is there a way to block certain IP addresses from accessing my site?
0
Comment
Question by:elliottbenzle
4 Comments
 
LVL 9

Expert Comment

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

Expert Comment

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

Expert Comment

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

deny from 123.255.255.0

of course add your own ip address
0
 
LVL 8

Accepted Solution

by:
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 192.168.0.1
    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 192.168.0.2
    deny from 192.168.0.3
    deny from 192.168.0.4
    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
0

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