How t0 protect .htaccess

Standard

Here is the code which shows the trick to protect the file using .htaccess file.

Protect File using .htaccess

Copy
 # protect file
<Files personal_data.txt>
order allow,deny
deny from all
</Files>

Enable access for particular user

Copy
 # protect file
<Files personal_data.txt>
order allow,deny
deny from all
allow from 1.2.3.4
allow from 45.85.245.105
</Files>

So above code will enable access from 1.2.3.4 and 45.85.245.105 only.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s