title: Configure htaccess to serve static django files
body: <p>I'm having trouble setting up Apache to serve static Django files.  I am on a shared host and don't have access to the Apache config files.  All the examples use <code>Alias</code> in the Apache config files, so I'm trying to figure out how to do it with mod_rewrite in .htaccess.</p>
  
  <p><strong>My setup.py looks like this:</strong></p>
  
  <pre><code>STATIC_ROOT = '/home2/usr/public_html/mydjangoproject/static'
  STATIC_URL = '/static/'
  </code></pre>
  
  <p>I ran <code>python manage.py collectstatic</code> in the terminal and it did its thing, so that now I have a folder under <code>/public_html/mydjangoproject/static</code> which currently has the subfolder <code>admin</code> and its content.</p>
  
  <p>Now I am trying to configure apache to just serve the static files rather than going through mod_wsgi, as it says in the documentation <a href="https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#serving-files">here</a>:</p>
  
  <blockquote>
    <p>We strongly recommend using django.contrib.staticfiles to handle the
    admin files (along with a Web server as outlined in the previous
    section; this means using the collectstatic management command to
    collect the static files in STATIC_ROOT, <strong>and then configuring your Web
    server to serve STATIC_ROOT at STATIC_URL</strong>)</p>
  </blockquote>
  
  <p>To do this, I added line 3 in the .htaccess file as shown below. This file is at <code>/home2/usr/public_html/mydjangoproject/.htaccess</code></p>
  
  <p><strong>My .htaccess file:</strong></p>
  
  <pre><code>AddHandler fcgid-script .fcgi
  RewriteEngine On
  RewriteRule /static/ /home2/usr/public_html/mydjangoproject/static
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
  </code></pre>
  
  <p>Note that I tried line 3 with and without the trailing slash, to no effect.</p>
  
  <p>When I go to www.mysite.com/mydjangoproject/static/ I receive a 500 Internal Server Error.  Likewise, the admin page is still not getting the css files it needs.  What's going on?</p>