Skip to content

Instantly share code, notes, and snippets.

@joetek
Last active February 6, 2018 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joetek/fbc780872f582ce1aa34bb1e8f104e17 to your computer and use it in GitHub Desktop.
Save joetek/fbc780872f582ce1aa34bb1e8f104e17 to your computer and use it in GitHub Desktop.
# .htaccess to block load-scripts.php and load-styles.php if user is not logged in.
#
# For styles, it redirects to the login.css, which includes *most* of the styles needed for the login screen.
# For scripts, it simply denies access with a 403 Forbidden.
#
# This workaround may have trouble if you have customized the login screen. Add this code to the top
# of your .htaccess file.
#
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} load-styles\.php*
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule (.*) /wp-admin/css/login.css [R=302,L]
RewriteCond %{REQUEST_URI} load-scripts\.php*
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule (.*) / [F]
</ifModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment