aboutsummaryrefslogtreecommitdiffstats
path: root/conf/httpd.conf
blob: 00532a3ab5d603372f8b705298c83b863be77f1d (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# 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>
#
#     Alias /admin/ /home/yourname/fixmystreet/web-admin/
# 
#     Alias /jslib/ "/home/yourname/fixmystreet/commonlib/jslib/"
# 
# </VirtualHost>
#
# 
# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
# Email: team@mysociety.org
# WWW: http://www.mysociety.org

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,L]
# RewriteRule ^/[Cc]/([0-9A-Za-z]{16,18}).*$ /confirm.cgi?type=update;token=$1  [QSA,L]
# RewriteRule ^/[Qq]/([0-9A-Za-z]{16,18}).*$ /questionnaire.cgi?token=$1        [QSA,L]
RewriteRule ^/[Ff]/([0-9A-Za-z]{16,18}).*$ /flickr.cgi?token=$1               [L]

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

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

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

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

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

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

# Proxy tilma so that our js code can make calls on the originating server. Use
# a RewriteRule rather than ProxyPass so that Apache's processing order is more
# predictable. ProxyPassReverse is not affected by this.
RewriteRule /tilma/(.*) http://tilma.mysociety.org/$1 [P,L]
ProxyPassReverse /tilma/ http://tilma.mysociety.org/

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

# serve static files directly
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
RewriteRule /(.+) /$1 [L]

# Explicitly capture all cgi files so that we can remove them one by one
# RewriteRule ^/confirm(.*)         /confirm.cgi$1            [L]
# RewriteRule ^/contact(.*)         /contact.cgi$1            [L]
RewriteRule ^/flickr(.*)          /flickr.cgi$1             [L]
# RewriteRule ^/fun(.*)             /fun.cgi$1                [L]
# RewriteRule ^/json(.*)            /json.cgi$1               [L]
# RewriteRule ^/photo(.*)           /photo.cgi$1              [L]
# RewriteRule ^/questionnaire(.*)   /questionnaire.cgi$1      [L]
# RewriteRule ^/reports(.*)         /reports.cgi$1            [L]
# RewriteRule ^/rss(.*)             /rss.cgi$1                [L]
RewriteRule ^/test(.*)            /test.cgi$1               [L]

RewriteRule ^/jslib(.*)               /jslib$1 [L,PT]

# trap anything that reaches us here and send it to the Catalyst app - this is
# so that we can gradually move functionality into the app without having to
# touch the existing code.
RewriteRule ^(.*)$               /fixmystreet_app_cgi.cgi$1  [L]