문제

I am trying to let useres upload their pictures at my website and I don't want to let others to see them, even if they know their URL. I would like to implement something like unaccesible folder at apache. (If it is possible from .htacess) I don't want to put them into database, because it slows server quite a lot (imo). Is there a solution? I saw something at FB, but its quite different league.

도움이 되었습니까?

해결책

You can disable public access to a directory using the .htaccess

RewriteEngine On
RewriteRule ^(?:images)\b.* index.php/$0 [L]

This would forward requests to the images folder to your index.php file.

This will only work if you have mod_rewrite enabled.

Also you could add a .htaccess file to the folder you would like to disable public access to and add the following rule.

deny from all
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top