.htaccess Why access to a file is forbidden on localhost?
-
I want to allow access to a file (secret.txt) only from my ip. Below is the .htaccess I'm using. It works great at my provider's server. However, at my localhost this .htaccess does not allow me to access the file. <Files "secret.txt"> order deny,allow deny from all allow from 1.2.3.4 </Files> Where my external ip is "1.2.3.4" I use Apache server locally. How can I make things work at localhost also?
-
Answer:
What Address are you using to access your local Apache server? If you're addressing it as localhost then you're probably not going all the way out of your machine via the network and back in again. This means that as far as your local Apache server is seeing you, you're coming from a loopback address. Try putting 127.0.0.1 in instead of your external IP, and see if that works.
Pavel at Stack Overflow Visit the source
Other answers
Try looking into your local server's access logs: does your local server see 1.2.3.4 when you are accessing the file from the computer that should be allowed? You may see a different IP address (due to NATs and whatnot).
Piskvor
Related Q & A:
- How to know if a file has 'access' monitor in linux?Best solution by Unix and Linux
- How to use htaccess to point to a different directory?Best solution by Stack Overflow
- Why can't I attach a file to my emails?Best solution by Yahoo! Answers
- Why can I not attach a file to my email?Best solution by Yahoo! Answers
- Why can't I get a file to open?Best solution by ask-leo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.