diff --git a/www/conservancy/middleware.py b/www/conservancy/middleware.py
index 87dec7a827443c6fe7b66d4bbe96fe441eff1766..2ea8d00a6f9e8577e9958e46101fce35f6235cc8 100644
--- a/www/conservancy/middleware.py
+++ b/www/conservancy/middleware.py
@@ -13,6 +13,11 @@ class ForceCanonicalHostnameMiddleware(object):
* adds cache headers to provide hints to squid
"""
+ # Never allow connection to the /admin part of the site without SSL
+ if (not request.is_secure) and request.path.startswith('/admin'):
+ url = 'https://sfconservancy.org%s' % request.path
+ return http.HttpResponseRedirect(url)
+
# Check for a redirect based on settings.APPEND_SLASH
host = http.get_host(request)
old_url = [host, request.path]
diff --git a/www/conservancy/urls.py b/www/conservancy/urls.py
index 75fb84d1dc89f68f85e108c86248d001849d008b..f3d26259f916c8e0dca25c7d256107bac7486c30 100644
--- a/www/conservancy/urls.py
+++ b/www/conservancy/urls.py
@@ -1,9 +1,32 @@
+# Copyright 2005-2008, James Garrison
+# Copyright 2010, 2012 Bradley M. Kuhn
+
+# This software's license gives you freedom; you can copy, convey,
+# propagate, redistribute, modify and/or redistribute modified versions of
+# this program under the terms of the GNU Affero General Public License
+# (AGPL) as published by the Free Software Foundation (FSF), either
+# version 3 of the License, or (at your option) any later version of the
+# AGPL published by the FSF.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program in a file in the toplevel directory called
+# "AGPLv3". If not, see .
+
from django.conf.urls.defaults import *
from conservancy.feeds import feed_dict
handler404 = 'modpythoncustom.view404'
+admin.autodiscover()
+
urlpatterns = patterns('',
+ (r'^admin/doc/', include('django.contrib.admindocs.urls')),
+ (r'^admin/(.*)', admin.site.root),
(r'^$', 'conservancy.frontpage.view'),
(r'^feeds/(?P.*)/?$', 'django.contrib.syndication.views.feed',
{'feed_dict': feed_dict}),
diff --git a/www/conservancy_ssl/__init__.py b/www/conservancy_ssl/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/www/conservancy_ssl/middleware.py b/www/conservancy_ssl/middleware.py
deleted file mode 100644
index 03b053609d9ba5b02e64a00a79562bebcb17236a..0000000000000000000000000000000000000000
--- a/www/conservancy_ssl/middleware.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2005-2008, James Garrison
-# Copyright 2010, Bradley M. Kuhn
-
-# This software's license gives you freedom; you can copy, convey,
-# propagate, redistribute, modify and/or redistribute modified versions of
-# this program under the terms of the GNU Affero General Public License
-# (AGPL) as published by the Free Software Foundation (FSF), either
-# version 3 of the License, or (at your option) any later version of the
-# AGPL published by the FSF.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program in a file in the toplevel directory called
-# "AGPLv3". If not, see .
-
-from django import http
-
-class RedirectToNonSslSite(object):
-
- def process_request(self, request):
- """Redirect to non-SSL site if not an admin request
- """
-
- if not request.path.startswith('/admin'):
- url = 'http://www.sfconservancy.org%s' % request.path
- return http.HttpResponseRedirect(url)
-
- return None
diff --git a/www/conservancy_ssl/settings.py b/www/conservancy_ssl/settings.py
deleted file mode 100644
index 11dfb6daef5df7fbd72af4b7e0bd3d683daebd28..0000000000000000000000000000000000000000
--- a/www/conservancy_ssl/settings.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2005-2008, James Garrison
-# Copyright 2010, Bradley M. Kuhn
-
-# This software's license gives you freedom; you can copy, convey,
-# propagate, redistribute, modify and/or redistribute modified versions of
-# this program under the terms of the GNU Affero General Public License
-# (AGPL) as published by the Free Software Foundation (FSF), either
-# version 3 of the License, or (at your option) any later version of the
-# AGPL published by the FSF.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program in a file in the toplevel directory called
-# "AGPLv3". If not, see .
-
-from conservancy.settings import *
-
-ROOT_URLCONF = 'conservancy_ssl.urls'
-
-MIDDLEWARE_CLASSES += ('conservancy_ssl.middleware.RedirectToNonSslSite',)
diff --git a/www/conservancy_ssl/urls.py b/www/conservancy_ssl/urls.py
deleted file mode 100644
index c0784fae33ecf09df1addfa56aa768d32fb929dc..0000000000000000000000000000000000000000
--- a/www/conservancy_ssl/urls.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2005-2008, James Garrison
-# Copyright 2010, Bradley M. Kuhn
-
-# This software's license gives you freedom; you can copy, convey,
-# propagate, redistribute, modify and/or redistribute modified versions of
-# this program under the terms of the GNU Affero General Public License
-# (AGPL) as published by the Free Software Foundation (FSF), either
-# version 3 of the License, or (at your option) any later version of the
-# AGPL published by the FSF.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program in a file in the toplevel directory called
-# "AGPLv3". If not, see .
-
-
-# Start with typical conservancy url scheme. The middleware will
-# intercept non-admin requests, but having the main conservancy urlconf
-# repeated here allows us to browse the automatic documentation in the
-# admin interface.
-
-from conservancy.urls import *
-from django.contrib import admin
-
-admin.autodiscover()
-
-urlpatterns += patterns('',
- (r'^admin/doc/', include('django.contrib.admindocs.urls')),
- (r'^admin/(.*)', admin.site.root),)