Skip to content

Instantly share code, notes, and snippets.

@fearlex
Created March 11, 2019 20:15
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 fearlex/38168be44b3f009a63c773876d1de55d to your computer and use it in GitHub Desktop.
Save fearlex/38168be44b3f009a63c773876d1de55d to your computer and use it in GitHub Desktop.
Wordpress .htaccess utils
#Force non-www
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule (.*) https://domain.com%{REQUEST_URI} [L,R=301,NC]
#Redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment