Locking a directory for downloads?
-
- A semi-regular
- Posts: 20
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Sat Jul 13, 2013 1:09 pm
Locking a directory for downloads?
So im creating a online store and they recommend locking down a folder to prevent people from indexing it and directly accessing it, while still being able to download the file via the temp link that the site generates for them.
Not sure what to put in the .htaccess for the folder if thats even it.
Anyone know?
Woo-commerce Related Site BTW
Not sure what to put in the .htaccess for the folder if thats even it.
Anyone know?
Woo-commerce Related Site BTW
Re: Locking a directory for downloads?
Yes, we talk about how to do that here.
http://www.nfoservers.com/forums/viewto ... =19&t=6423
http://www.nfoservers.com/forums/viewto ... =19&t=6423
@Kraze^NFo> Juski has a very valid point
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
-
- A semi-regular
- Posts: 20
- Joined: Sat Jul 13, 2013 1:09 pm
Re: Locking a directory for downloads?
I looked at this and it only solves one issue I have. The other thing is keeping bots(all of them) out as well.kraze wrote:Yes, we talk about how to do that here.
http://www.nfoservers.com/forums/viewto ... =19&t=6423
Re: Locking a directory for downloads?
That tutorial is inaccurate. An index won't prevent people from getting the contents of a directory, for example you can recursively wget and get the contents of a directory.kraze wrote:Yes, we talk about how to do that here.
http://www.nfoservers.com/forums/viewto ... =19&t=6423
For Apache, you simply add this in your .htaccess to prevent directory listing: 'Options -Indexes'.
In Nginx you use: 'autoindex off;' in your configuration file.
For keeping bots out such as search engines, you can block them via a robots.txt file to keep search engines from indexing it.
An example of a robots.txt file for keeping all search engines (that respect robots.txt, which are all major ones) would be:
Code: Select all
User-agent: *
Disallow: /downloads
-
- A semi-regular
- Posts: 20
- Joined: Sat Jul 13, 2013 1:09 pm
Re: Locking a directory for downloads?
rymax99 wrote:That tutorial is inaccurate. An index won't prevent people from getting the contents of a directory, for example you can recursively wget and get the contents of a directory.kraze wrote:Yes, we talk about how to do that here.
http://www.nfoservers.com/forums/viewto ... =19&t=6423
For Apache, you simply add this in your .htaccess to prevent directory listing: 'Options -Indexes'.
In Nginx you use: 'autoindex off;' in your configuration file.
For keeping bots out such as search engines, you can block them via a robots.txt file to keep search engines from indexing it.
An example of a robots.txt file for keeping all search engines (that respect robots.txt, which are all major ones) would be:Code: Select all
User-agent: * Disallow: /downloads
Thanks for all this info. So just to make sure I did this right:
I put the robots.txt in the root and changed the /whatever to what it needs to be.
Also added an .htaccess file with 'Options -Indexes' in it in that wanted protected directory.
Is all that correct?
Re: Locking a directory for downloads?
Correct. To test to make sure that /whatever is protected, simply access that directory (remove the index.html if it exists), and it should throw a 403 forbidden message.silentwisher wrote:rymax99 wrote:That tutorial is inaccurate. An index won't prevent people from getting the contents of a directory, for example you can recursively wget and get the contents of a directory.kraze wrote:Yes, we talk about how to do that here.
http://www.nfoservers.com/forums/viewto ... =19&t=6423
For Apache, you simply add this in your .htaccess to prevent directory listing: 'Options -Indexes'.
In Nginx you use: 'autoindex off;' in your configuration file.
For keeping bots out such as search engines, you can block them via a robots.txt file to keep search engines from indexing it.
An example of a robots.txt file for keeping all search engines (that respect robots.txt, which are all major ones) would be:Code: Select all
User-agent: * Disallow: /downloads
Thanks for all this info. So just to make sure I did this right:
I put the robots.txt in the root and changed the /whatever to what it needs to be.
Also added an .htaccess file with 'Options -Indexes' in it in that wanted protected directory.
Is all that correct?
-
- A semi-regular
- Posts: 20
- Joined: Sat Jul 13, 2013 1:09 pm
Re: Locking a directory for downloads?
It throws a 500 Internal Server Error.
Re: Locking a directory for downloads?
That is more than likely to be a result of adding Options -Indexes to your .htaccess file. Comment it out and see if you still get the 500 error.silentwisher wrote:It throws a 500 Internal Server Error.
Re: Locking a directory for downloads?
The web server probably doesn't allow override, which would cause that error.
-
- A semi-regular
- Posts: 20
- Joined: Sat Jul 13, 2013 1:09 pm
Re: Locking a directory for downloads?
Alright so support pointed out I had a extra character there. So now thats fixed. So for confirmation, as long as they dont have the link they cant find it basically?rymax99 wrote:The web server probably doesn't allow override, which would cause that error.
Re: Locking a directory for downloads?
the smallest syntax error in your htaccess file will get you a Error 500: Internal Server Error.silentwisher wrote:Alright so support pointed out I had a extra character there. So now thats fixed.
Re: Locking a directory for downloads?
Correct.silentwisher wrote:Alright so support pointed out I had a extra character there. So now thats fixed. So for confirmation, as long as they dont have the link they cant find it basically?rymax99 wrote:The web server probably doesn't allow override, which would cause that error.
-
- A semi-regular
- Posts: 20
- Joined: Sat Jul 13, 2013 1:09 pm
Re: Locking a directory for downloads?
Awesome! Well I appreciate all the help!rymax99 wrote:Correct.silentwisher wrote:Alright so support pointed out I had a extra character there. So now thats fixed. So for confirmation, as long as they dont have the link they cant find it basically?rymax99 wrote:The web server probably doesn't allow override, which would cause that error.


Re: Locking a directory for downloads?
No problem.