title: Django: Restrict static folder access to non logged-in users
body: <p>I am trying to restrict those users, who directly hit on a absolute static image url path(www.xyz.com/static/img/sam.png) in browser and access it.</p>
  
  <p>I tried with the following django docs:</p>
  
  <p><a href="https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/apache-auth/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/apache-auth/</a></p>
  
  <p>But this will block those images which are there in login page also(before valid user is authenticated).</p>
  
  <p>Is there any other efficient way to do restrict <strong>non logged-in</strong> users?</p>
  
  <p><strong>EDIT:</strong>
  I had referred to this <a href="https://stackoverflow.com/questions/2687957/django-serving-media-behind-custom-url">Django: Serving Media Behind Custom URL</a> but it is related to nginx and not apache.
  And also there is a difference b/w static and media content. My question is related to just static content</p>