How to Block an IP Address With Htaccess

104 18
    • 1). Right-click the .htaccess file in your website directory and select "Open With." In the list of programs, double-click "Notepad" to open the .htaccess file in the text editor.

    • 2). Scroll down to the section labeled "order allow,deny." You can also quickly find this section by clicking the "Edit" menu item and select "Find." Enter "order allow,deny" into the text box. If there is no "order allow,deny" section, add this text to the first line of your .htaccess file.

    • 3). Enter the IP address you want to block. For example, the following code blocks the "192.168.1.1" IP address:

      deny from 192.168.1.1

      Repeat this line for each IP address you want to block.

    • 4). Click the "File" menu item and select "Save" to save your changes to the .htaccess file.

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.