View all our .htaccess Cheatsheet snippets here
This will allow access to all IPs EXCEPT the ones listed. You can use this to allow all access Except Spammer's IP addresses.
Replace xxx.xxx.xxx.xxx and xxx.xxx.xxx.xxy with the IP addresses you want to block.
Allow from all
Deny from xxx.xxx.xxx.xxx
Deny from xxx.xxx.xxx.xxy
# Require all granted
# Require not ip xxx.xxx.xxx.xxx
# Require not ip xxx.xxx.xxx.xxy
Remember that for most rules you must have the
RewriteEngine on rule in your .htaccess file!!!
Please remember to double check and verify any rules that you use. If you do not understand a rule please consult someone who does. Or if you are new, please take time to learn the basics of .htaccess. We accept no responsibility for your use of these rules - use them at your own risk. Please get in touch if you want us to add a rule!
• Terms and Conditions •
This website is 100% free and one of the fastest loading .htaccess cheatsheet webpages on the web. It is all on one page, and optimised to help it quickly load and for you to easily find the .htaccess rules you need. Please get in touch if you have any questions.
If you use this please consider linking back to https://htaccesscheatsheet.com/
Based heavily (on its first version) from phanan/htaccess
Snippets with specified source belong to their respective owners and have
their own license(s), whenever appropriate.
Other content belongs to the public domain. Refer to Unlicense
for more information.