You must not use mod_rewrite, if you have access to the apache VirtualHost config.
This is better, because mod_rewrite costs more or less resources.

If you use the VirtualHost config section, you should "disable" the prepared /var/www/YourSite/.htaccess file!

mod_wsgi

Here a example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<VirtualHost *:80>
    ServerName YourDomain.tld

    Alias /static/ "/var/www/YourSite/static/"
    Alias /favicon.ico "/var/www/YourSite/favicon.ico"

    # Activate script Handler (not needed in every cases)
    # http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addhandler
    #
    # libapache2-mod-wsgi
    #AddHandler wsgi-script .wsgi

    WSGIScriptAlias / "/var/www/YourSite/index.wsgi"

    <Directory /var/www/YourSite>
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

(more examples are on the mod_wsgi IntegrationWithDjango wiki page)

fast_CGI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<VirtualHost *:80>
    ServerName YourDomain.tld

    Alias /static/ "/var/www/YourSite/static/"
    Alias /favicon.ico "/var/www/YourSite/favicon.ico"

    # Activate script Handler (not needed in every cases)
    # http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addhandler
    #
    # Old libapache2-mod-fastcgi Apache module:
    #AddHandler fastcgi-script .fcgi
    #
    # New libapache2-mod-fcgid Apache module:
    #AddHandler fcgid-script .fcgi

    ScriptAlias / "/var/www/YourSite/index.fcgi"

    <Directory /var/www/YourSite>
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

(To use CGI change ".fcgi" to ".cgi" in ScriptAlias line...)