Setting up .htaccess restrictions

Created at:
Avatar
Updated

If you do not have access to a network firewall and you would like to deny any direct (not through Incapsula) access to your web server you can define access control rules using your Apache .htaccess file.

In order to allow all traffic coming from Incapsula IPs and deny any access from non-Incapsula IPs insert the following lines into your .htaccess file:

 

order deny,allow

deny from all

allow from IP1/Mask1

allow from IP2/Mask2

 

In this example IP/Mask is the Incapsula IPs (Please follow this article).

Make sure to subscribe to this knowledge-base item to receive updates on changes in the Incapsula IPs.

 

For example, the following configuration will make sure that any traffic not coming from 199.83.128.0/21 will be blocked.

 

order deny,allow

deny from all

allow from 199.83.128.0/21

...

Was this article helpful?
8 out of 8 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Allan Benamer

    Drupal uses an order allow,deny directive instead. How would that usage affect this recommendation?

  • Avatar
    Olaf Lederer

    Hi,

    I  installed the WP plugin and I like to protect my wp-admin directory using this code in the .htaccess file (which works without Incapsula)

    AuthUserFile /dev/null

    AuthGroupFile /dev/null

    AuthName "Password Protected Area"

    AuthType Basic

    order deny,allow

    deny from all

    whitelist Incapsula

    allow from 199.83.128.0/21

    whitelist home IP address

    allow from 95.97.177.150

    Do need to wait a little bit longer?

  • Avatar
    Olaf Lederer

    ooh I see I need to expand my list to:

     

    allow from 199.83.128.0/21

    allow from 198.143.32.0/19

    allow from 149.126.72.0/21

    allow from 103.28.248.0/22

    allow from 46.51.174.78

    allow from 122.248.247.129

    allow from 50.16.241.95

    allow from 50.16.241.176

    allow from 184.169.135.107

    allow from 184.169.135.111

    allow from 46.137.108.0

    allow from 46.51.168.190

    allow from 79.125.110.134

    allow from 79.125.118.62

  • Avatar
    khaled elsayed

    whoare you

  • Avatar
    Famous

    Taken atm card in gtbank ojodu,wish deposite 920naira to my iproo bim account,need to collect instantly urgent.Send to me instant.

    Best Regard

    Sincerely
    iproo bim.

Powered by Zendesk