/
httpd.conf
90 lines (69 loc) · 3.61 KB
/
httpd.conf
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
# Apache configuration for TheyWorkForYou.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org
#
# $Id: httpd.conf,v 1.17 2009-02-26 17:47:07 matthew Exp $
<Location /fcgi>
Options +ExecCGI
SetHandler fastcgi-script
</Location>
DirectoryIndex index.php index.html
ErrorDocument 404 /404.php
RewriteEngine on
#RewriteLog /var/log/apache/rewrite.log
#RewriteLogLevel 3
# Channel 4 branded pages
RewriteRule ^/mps/(c4|c4x)/$ /mps/ [R]
RewriteRule ^/mp/(c4|c4x)/(['a-zA-Z_+-]+)/([\(\)\.a-zA-Z_+,'-]+)$ /mp/$2/$3 [R]
# List of rep pages
RewriteRule ^/(msp|mla|peer)s/$ /mps/index.php?$1=1 [QSA]
# Links in emails
RewriteRule ^/A/(.*)$ /alert/index.php?action=Confirm&t=$1 [QSA]
RewriteRule ^/D/(.*)$ /alert/index.php?t=$1 [QSA]
RewriteRule ^/U/(.*)$ /user/confirm/index.php?t=$1 [QSA]
RewriteRule ^/B/(.*)$ /freeourbills/subscribe.php?t=$1 [QSA]
RedirectPermanent /awstats http://cake.ukcod.org.uk/awstats/awstats.pl?config=theyworkforyou
RedirectPermanent /termsofuse http://www.theyworkforyou.com/about
RedirectPermanent /raw http://ukparse.kforge.net/parlparse
# For election survey postal mails (can turn off after General Election 2010)
RedirectPermanent /ppc http://election.theyworkforyou.com/survey
RedirectPermanent /ppcs http://election.theyworkforyou.com/survey
# API
RewriteRule ^/api/((get|convert).*)$ /api/index.php?method=$1 [QSA]
RewriteRule ^/api/docs/?$ /api/ [R=permanent]
RewriteRule ^/api/docs/(.*)$ /api/index.php?docs=1&method=$1 [QSA]
# Other people types
RewriteRule ^/(peer|royal|mla|msp)/$ /mp/index.php?$1=1 [QSA]
# Inherited the title in 2003
RewriteRule ^/peer/viscount_cranborne /peer/marquess_of_salisbury [R=permanent]
RewriteRule ^/(peer|royal|mla|msp)/(.+) /mp/$2?$1=1 [QSA]
# Calendar
RewriteRule ^/calendar/([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])$ /calendar/index.php?d=$1
# MP pages
RewriteRule ^/mp/(['a-zA-Z_+-]+)/([\(\)\.a-zA-Z_+,'-]+)$ /mp/index.php?n=$1&c=$2 [QSA]
RewriteRule ^/mp/(['a-zA-Z_\ +-]+)\ mp/?$ /mp/index.php?n=$1 [QSA]
RewriteRule ^/mp/(['a-zA-Z_\ +-]+)/?$ /mp/index.php?n=$1 [QSA]
# Public Bill Committees
RewriteRule ^/pbc/([0-9][0-9][0-9][0-9]-[0-9][0-9])$ /pbc/$1/ [R=permanent]
RewriteRule ^/pbc/([0-9][0-9][0-9][0-9]-[0-9][0-9])/$ /pbc/index.php?session=$1 [QSA]
RewriteRule ^/pbc/([0-9][0-9][0-9][0-9]-[0-9][0-9])/([^/]+)$ /pbc/$1/$2/ [R=permanent]
RewriteRule ^/pbc/([0-9][0-9][0-9][0-9]-[0-9][0-9])/([^/]+)/$ /pbc/index.php?session=$1&bill=$2 [QSA]
RewriteRule ^/pbc/([0-9][0-9][0-9][0-9]-[0-9][0-9])/([^/]+)/(.+)$ /pbc/index.php?session=$1&bill=$2&id=$3 [QSA]
RewriteRule ^/alerts/.*$ /alert/ [R=permanent]
RewriteRule ^/rss/mp/$ /mp/ [R]
# News
RewriteRule ^/news/archives/(.*)$ /news/index.php/archives/$1 [QSA]
RewriteRule ^/news/index.rdf$ /news/rdf.php [QSA]
# Department (not ready)
RewriteRule ^/departments/(.*)/questions$ /departments/questions.php?dept=$1
RewriteRule ^/departments/(.*)/statements$ /departments/statements.php?dept=$1
# BBC Gadget
RewriteRule ^/gadget/bbc/([0-9]+)/data$ /gadget/bbc.php?action=data&id=$1
RewriteRule ^/gadget/bbc/([0-9]+)/latest$ /gadget/bbc.php?action=latest&id=$1
# Guardian
RewriteRule ^/gadget/guardian/resources/mp/([a-z-]+)/([0-9]+)$ /gadget/guardian/index.php?action=$1-resource&pid=$2 [QSA]
RewriteRule ^/gadget/guardian/components/mp/([a-z-]+)/([0-9]+)$ /gadget/guardian/index.php?action=$1-component&pid=$2
# PHP files can be referred without PHP
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule /(.+) /$1.php [PT]