Skip to content

Instantly share code, notes, and snippets.

@SalmanRavoof
Created October 9, 2019 20:36
Show Gist options
  • Save SalmanRavoof/94ca7a072caf0578c5c517d9ca72946f to your computer and use it in GitHub Desktop.
Save SalmanRavoof/94ca7a072caf0578c5c517d9ca72946f to your computer and use it in GitHub Desktop.
Force any HTTP request to redirect to HTTPS by adding the first three lines to your WordPress .htaccess file. Never put it in between the WordPress tags.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# BEGIN WordPress
# END WordPress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment