| 1 | # |
|---|
| 2 | # PyLucid .htaccess file |
|---|
| 3 | # per default: using the CGI Version (index.cgi) |
|---|
| 4 | # |
|---|
| 5 | # You can easy change the rewrite rule to use fastCGI, see below. |
|---|
| 6 | # |
|---|
| 7 | # Note: |
|---|
| 8 | # You should be carefull uncomment settings. |
|---|
| 9 | # It can be that not all rules are permitted! |
|---|
| 10 | # If you activate a "not allowed" rule, the server can send a |
|---|
| 11 | # "500 internal server error" for every request! |
|---|
| 12 | # The best way: uncomment one after another and check a request/response |
|---|
| 13 | # after every step. |
|---|
| 14 | # |
|---|
| 15 | # see also: |
|---|
| 16 | # http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride |
|---|
| 17 | # |
|---|
| 18 | |
|---|
| 19 | # Enable execution of CGI scripts using mod_cgi |
|---|
| 20 | # http://httpd.apache.org/docs/2.0/mod/core.html#options |
|---|
| 21 | #Options +ExecCGI |
|---|
| 22 | |
|---|
| 23 | # Old mod_fastcgi Apache module: |
|---|
| 24 | #AddHandler fastcgi-script .fcgi |
|---|
| 25 | |
|---|
| 26 | # New mod_fcgid Apache module: |
|---|
| 27 | #AddHandler fcgid-script .fcgi |
|---|
| 28 | |
|---|
| 29 | # http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addhandler |
|---|
| 30 | #AddHandler cgi-script .cgi |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | # http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html |
|---|
| 34 | RewriteEngine On |
|---|
| 35 | |
|---|
| 36 | # All requests would be "redirected" to PyLucid. |
|---|
| 37 | # Here we can exclude some directories. |
|---|
| 38 | # Default: Leave out all request to /media/ |
|---|
| 39 | # You can add more directories if needed. |
|---|
| 40 | RewriteRule ^media - [L] |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | # Forbid the directly access to some files (send 403 HTTP response) |
|---|
| 44 | RewriteRule ^index.cgi$ - [F,L] |
|---|
| 45 | RewriteRule ^index.fcgi$ - [F,L] |
|---|
| 46 | RewriteRule ^manage.py$ - [F,L] |
|---|
| 47 | RewriteRule ^local_settings.py$ - [F,L] |
|---|
| 48 | |
|---|
| 49 | RewriteCond %{REQUEST_FILENAME} !-f |
|---|
| 50 | |
|---|
| 51 | # for CGI Version: |
|---|
| 52 | #RewriteRule ^(.*)$ index.cgi/$1 [QSA,L] |
|---|
| 53 | |
|---|
| 54 | # for fastCGI Version: |
|---|
| 55 | RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L] |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | # Nobody should have access to some files! |
|---|
| 59 | # If you use a SQLite Database and the DB file is in you DocRoot, you should |
|---|
| 60 | # also deny the access for everybody. |
|---|
| 61 | # http://httpd.apache.org/docs/2.2/mod/core.html#files |
|---|
| 62 | <Files manage.py> |
|---|
| 63 | Deny from all |
|---|
| 64 | </Files> |
|---|
| 65 | <Files local_settings.py> |
|---|
| 66 | Deny from all |
|---|
| 67 | </Files> |
|---|