aboutsummaryrefslogtreecommitdiffstats
path: root/conf/httpd.conf
blob: 80fbe8c40519fd2f8fdefe7cda8e30323057395a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Apache configuration for FixMyStreet.
#
# Add lines something like this to your /etc/apache2/sites-enabled/fixmystreet -
# replacing '/home/yourname/fixmystreet' with the path to your install
#
# # FixMyStreet
# <VirtualHost *:80>
#     ServerName fixmystreet.yourservername
#     DocumentRoot /home/yourname/fixmystreet/web/
# 
#     # Pull in the specific config
#     Include /home/yourname/fixmystreet/conf/httpd.conf
# 
#     <Directory /home/yourname/fixmystreet/web>
#         # You also need to enable cgi files to run as CGI scripts.  For example:
#         # on production servers these are run under fastcgi
#         Options +ExecCGI
#         AddHandler cgi-script .cgi
#     </Directory>
# 
#     <Directory /home/yourname/fixmystreet/web-admin>
#         # 
#         #  WARNING - enable auth here on production machine
#         # 
#         Options +ExecCGI
#         AddHandler cgi-script .cgi
#     </Directory-admin>
#
#     Alias /admin/ /home/yourname/fixmystreet/web-admin/
# 
# </VirtualHost>
#
# 
# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. Email:
# francis@mysociety.org; WWW: http://www.mysociety.org
# 
# $Id: httpd.conf,v 1.40 2009-10-21 15:22:36 louise Exp $

DirectoryIndex index.cgi

RewriteEngine on
#RewriteLog /var/log/apache2/rewrite.log
#RewriteLogLevel 3

# End slashes goodbye
RewriteRule ^/admin/     - [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.+)/$     $1 [R=permanent]

# Confirmation tokens
RewriteRule ^/[Aa]/([0-9A-Za-z]{16,18}).*$ /alert.cgi?token=$1 [QSA]
RewriteRule ^/[Cc]/([0-9A-Za-z]{16,18}).*$ /confirm.cgi?type=update;token=$1 [QSA]
RewriteRule ^/[Pp]/([0-9A-Za-z]{16,18}).*$ /confirm.cgi?type=problem;token=$1 [QSA]
RewriteRule ^/[Qq]/([0-9A-Za-z]{16,18}).*$ /questionnaire.cgi?token=$1 [QSA]
RewriteRule ^/[Ff]/([0-9A-Za-z]{16,18}).*$ /flickr.cgi?token=$1
RewriteRule ^/[Ll]/([0-9A-Za-z]{16,18}).*$ /index.cgi?partial_token=$1
RewriteRule ^/[Tt]/([0-9A-Za-z]{16,18}).*$ /tms-signup.cgi?token=$1

# RSS feeds for updates on a problem
RewriteRule ^/rss/([0-9]+)$              /rss.cgi?type=new_updates;id=$1 [QSA]

# RSS feeds for new local problems
RewriteRule ^/rss/([0-9]+)[,/]([0-9]+)$              /rss.cgi?type=local_problems;x=$1;y=$2 [QSA]
RewriteRule ^/rss/n/([0-9]+)[,/]([0-9]+)$              /rss.cgi?type=local_problems;e=$1;n=$2 [QSA]
RewriteRule ^/rss/l/([0-9.-]+)[,/]([0-9.-]+)$        /rss.cgi?type=local_problems;lat=$1;lon=$2 [QSA]
RewriteRule ^/rss/([0-9]+)[,/]([0-9]+)/([0-9]+)$     /rss.cgi?type=local_problems;x=$1;y=$2;d=$3 [QSA]
RewriteRule ^/rss/n/([0-9]+)[,/]([0-9]+)/([0-9]+)$     /rss.cgi?type=local_problems;e=$1;n=$2;d=$3 [QSA]
RewriteRule ^/rss/l/([0-9.-]+)[,/]([0-9.-]+)/([0-9]+)$   /rss.cgi?type=local_problems;lat=$1;lon=$2;d=$3 [QSA]
RewriteRule ^/rss/pc/(.*)$                           /rss.cgi?type=local_problems;pc=$1 [QSA]
RewriteRule ^/rss/problems$                          /rss.cgi?type=new_problems [QSA]

# RSS feeds for voting areas
RewriteRule ^/rss/council/([0-9]+)$                 /rss/reports/$1 [R=permanent]
RewriteRule ^/report$                               /reports   [R=permanent]
RewriteRule ^/reports/([^/]+)/all$                  /reports.cgi?council=$1;all=1  [QSA]
RewriteRule ^/reports/([^/]+)/([^/]+)$              /reports.cgi?council=$1;ward=$2  [QSA]
RewriteRule ^/rss/(reports|area)/([^/]+)/([^/]+)$   /reports.cgi?rss=$1;council=$2;ward=$3 [QSA]
RewriteRule ^/reports/([^/]+)$                      /reports.cgi?council=$1  [QSA]
RewriteRule ^/rss/area/([0-9]+)$                    /rss.cgi?type=area_problems;id=$1 [QSA]
RewriteRule ^/rss/(reports|area)/([^/]+)$           /reports.cgi?rss=$1;council=$2 [QSA]

# Fix incorrect RSS urls caused by my stupidity
RewriteRule ^/{/rss/(.*)}$              /rss/$1 [R=permanent]
RewriteRule ^/reports/{/rss/(.*)}$      /rss/$1 [R=permanent]

RewriteRule ^/report/([0-9]+)$               /index.cgi?id=$1 [QSA]
RewriteRule ^/report/([0-9]+)                /report/$1 [R]
RewriteRule ^/alerts/?$                      /alert [R=permanent]

# JSON API for summaries of reports
RewriteRule ^/json/problems/new$            /json.cgi?type=new_problems [QSA]
RewriteRule ^/json/problems/fixed$          /json.cgi?type=fixed_problems [QSA]

ProxyPass /tilma/ http://tilma.mysociety.org/ 
ProxyPassReverse /tilma/ http://tilma.mysociety.org/

# CGI files can be referred without CGI
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.cgi -f
RewriteRule /(.+) /$1.cgi

# S. Cambs
RewriteRule ^/images/southcambridgeshiredistrictcouncil/icons/internet/print.gif$ http://www.scambs.gov.uk/images/southcambridgeshiredistrictcouncil/icons/internet/print.gif [R=permanent]