1

I have an idea below text in .htaccess file in magento root folder. Order allow,deny tells your web server that the Allow rules are processed before the Deny rules. Order deny, allow means that the deny rules are processed before the allow rules.

#

By default allow all access

Order allow,deny
Allow from all

After that i added below text "Deny from 122.179.87.208"

above ip address is my system public ip address.But still i able to access magento site(localhost)

and through cmd ipconfig command i get different ip now .using that ip address also i'm able to access my site. So where my configuration is wrong.Thanks in advance.

1
  • Come and edit the htaccess file to limit the sole to IP only ONLY for some subdomains (and keep all IPs for the main site)? Thanks
    – ANG
    Commented Nov 5, 2018 at 20:14

3 Answers 3

3
order deny,allow
deny from all
allow from 111.222.333.444
2

When you access localhost (even when you use full name or IP address) your client machine identifies itself as 127.0.0.1 (it's localhost IP equivalent). Since 127.0.0.1 is not in your deny list, it allows you to continue.

If you want to investigate this thing further, use PHP to print out $_SERVER["REMOTE_ADDR"] to see how server recognises your client machine.

3
  • now i'm adding 127.0.0.1 to deny list.but still i can access.Please once try this thing.
    – sivakumar
    Commented May 23, 2014 at 12:30
  • Well, this should work order allow,deny deny from 123.123.123.123 deny from 123.123.123.123/30 deny from 123.123.* allow from all should work, unless you are using wrong scope (such as specific subfolder).
    – Pronto
    Commented May 23, 2014 at 12:43
  • Few additional ideas: are you sure that .htaccess file is accessible for Apache? Are you sure that there no overriding directives, such as <Directory />? Are you sure that there's no AllowOverride None somewhere?
    – Pronto
    Commented May 23, 2014 at 15:31
1

Add the following lines on bottom of root .htaccess file:

Order deny,allow
Deny from all
Allow from 119.82.68.252

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.