diff --git a/r2/r2/controllers/reddit_base.py b/r2/r2/controllers/reddit_base.py
index d11261e3e..1c3fed972 100644
--- a/r2/r2/controllers/reddit_base.py
+++ b/r2/r2/controllers/reddit_base.py
@@ -508,6 +508,17 @@ class RedditController(BaseController):
and c.render_style == 'html'):
return self.intermediate_redirect("/over18")
+ #check whether to allow custom styles
+ c.allow_styles = True
+ if g.css_killswitch:
+ c.allow_styles = False
+ #if the preference is set and we're not at a cname
+ elif not c.user.pref_show_stylesheets and not c.cname:
+ c.allow_styles = False
+ #if the site has a cname, but we're not using it
+ elif c.site.domain and not c.cname:
+ c.allow_styles = False
+
#check content cache
if not c.user_is_loggedin:
r = cache.get(self.request_key())
diff --git a/r2/r2/templates/reddit.html b/r2/r2/templates/reddit.html
index 1025f0607..570be013a 100644
--- a/r2/r2/templates/reddit.html
+++ b/r2/r2/templates/reddit.html
@@ -52,7 +52,7 @@
%else:
- %if (not g.css_killswitch) and c.user.pref_show_stylesheets:
+ %if c.allow_styles:
%if c.site.stylesheet: