diff options
-rw-r--r-- | conf/httpd.conf | 113 |
1 files changed, 70 insertions, 43 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf index 1074b799d..92c04e9d5 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -31,16 +31,15 @@ # </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 $ +# 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 +# RewriteLog /var/log/apache2/rewrite.log +# RewriteLogLevel 3 # End slashes goodbye RewriteRule ^/admin/ - [L] @@ -48,56 +47,84 @@ 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 +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 ^/[Pp]/([0-9A-Za-z]{16,18}).*$ /confirm.cgi?type=problem;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] +RewriteRule ^/[Ll]/([0-9A-Za-z]{16,18}).*$ /index.cgi?partial_token=$1 [L] +RewriteRule ^/[Tt]/([0-9A-Za-z]{16,18}).*$ /tms-signup.cgi?token=$1 [L] # RSS feeds for updates on a problem -RewriteRule ^/rss/([0-9]+)$ /rss.cgi?type=new_updates;id=$1 [QSA] +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] -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/(.*)/([0-9]+)$ /rss.cgi?type=local_problems;pc=$1;d=$2 [QSA] -RewriteRule ^/rss/pc/(.*)$ /rss.cgi?type=local_problems;pc=$1 [QSA] -RewriteRule ^/rss/problems$ /rss.cgi?type=new_problems [QSA] +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] -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] +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] -RewriteRule ^/reports/{/rss/(.*)}$ /rss/$1 [R=permanent] +RewriteRule ^/{/rss/(.*)}$ /rss/$1 [R=permanent,L] +RewriteRule ^/reports/{/rss/(.*)}$ /rss/$1 [R=permanent,L] -RewriteRule ^/report/([0-9]+)$ /index.cgi?id=$1 [QSA] -RewriteRule ^/report/([0-9]+) /report/$1 [R] -RewriteRule ^/alerts/?$ /alert [R=permanent] +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] -RewriteRule ^/json/problems/fixed$ /json.cgi?type=fixed_problems [QSA] +RewriteRule ^/json/problems/new$ /json.cgi?type=new_problems [QSA,L] +RewriteRule ^/json/problems/fixed$ /json.cgi?type=fixed_problems [QSA,L] -ProxyPass /tilma/ http://tilma.mysociety.org/ +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] + +# 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 /about(.*) /about.cgi$1 [L] +RewriteRule /ajax(.*) /ajax.cgi$1 [L] +RewriteRule /alert(.*) /alert.cgi$1 [L] +RewriteRule /confirm(.*) /confirm.cgi$1 [L] +RewriteRule /contact(.*) /contact.cgi$1 [L] +RewriteRule /faq(.*) /faq.cgi$1 [L] +RewriteRule /flickr(.*) /flickr.cgi$1 [L] +RewriteRule /fun(.*) /fun.cgi$1 [L] +RewriteRule /import(.*) /import.cgi$1 [L] +RewriteRule /$ /index.cgi [L] +RewriteRule /index(.*) /index.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 /tms-signup(.*) /tms-signup.cgi$1 [L] +RewriteRule /upload(.*) /upload.cgi$1 [L] + +# 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 [L] + + |