Skip to content

Instantly share code, notes, and snippets.

@robi052
Last active December 27, 2020 15:17
Show Gist options
  • Save robi052/89d80c746369a94541f35ff07ea07df1 to your computer and use it in GitHub Desktop.
Save robi052/89d80c746369a94541f35ff07ea07df1 to your computer and use it in GitHub Desktop.
htaccess tips and tricks what I'm using
#forward http to https and non-www to www with only 1 hop
#hop test https://varvy.com/tools/redirects/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
#Block Wordpress authors scan
<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} (author=\d+) [NC]
RewriteRule .* - [F]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment