I know there are alot of questions out there related to this, but mine is slightly diferent.
I may clear up that I am a junior in PHP (or less) and I am just dealing with new stuff. This is one of those.
Basically I want allow access to my admin folder in my server only to me. Which, I believe I can achieve through my IP. I found this to be put in the .htaccess file:
order allow,deny
allow from xxx.xx.xx.xxx
deny from all
Obviously, being the x's my public IP that I got from Google.
Now, when I try to access the folder with my computer it says "403 Forbidden" which means it kind of worked. But it is also blocking my IP. So, here comes my questions.
Is there more than one IP in a computer? If yes, which one should I use? How can I get it? What's the difference among them? What am I doing wrong?
Any help will be very apreciated. Thank you in advance.
EDIT: Also, I am not working on localhost. I am working remotely in the server I have uploaded my website to.
If you going to acces from you own computer, you have to use your local ip, in windows you can find in the console using ipconfig
, in unix systems ifconfig
.
should be something like this
order allow,deny
allow from 192.168.0.1//127.0.0.1 or localhost
deny from all
Ok, I figured out. It seems the problem was the order.
order deny,allow
deny from all
allow from {mi_ip}
That works, with the other way around deny all
seemed to overwrite the allowed IP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.