.htaccess not working prperly

Status
Not open for further replies.
Messages
92
Reaction score
1
Points
8
Hi I was trying to deny all ip for my website instead my ip so I tried to write .htacces. I wrote exactly like this
PHP]order deny,allow
deny from all
allow from 192.168.*.*[/PHP]
But from my ip also getting 403 forbidden tried by full ip address also but not working any thing.


So, How to solve it?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
They have a load balancing system and the IP address given to .htaccess is not the IP of the request.

You have to somehow use the HTTP FORWARDED-FOR header information instead. I haven't seen a solution that has been verified as working (in .htaccess ... PHP files have a way of accessing the headers).
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Why do you want to make your site totally private?
 
Messages
92
Reaction score
1
Points
8
Last time my site almost hacked and I am wring a new script so I have to test so I want to keep open it for me and closed for every body to avoid hack attempt because I can not administrate and write script together.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
At the top of any PHP script, test

$_ENV[ 'HTTP_X_FORWARDED_FOR' ] or $_ENV[ 'HTTP_X_REAL_IP' ]

If it isn't yours, just redirect them to a stock "Welcome" page.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
If you are not using PHP, and have to use .htaccess:

RewriteCond %{HTTP:X-Forwarded-For} !^133\.66\.13\.78$
RewriteRule ^(.*)$ youarenotwelcome.html [L]

Replace the IP with yours and the rewrite to a page kindly notifying them that access is denies.

Works on an account on Chopin.

Remember that x10hosting accounts are for websites.
 
Status
Not open for further replies.
Top