Skip to content

Instantly share code, notes, and snippets.

@JuniorTak
Created August 15, 2024 18:29
Show Gist options
  • Save JuniorTak/6527e36fbd52c46ab7e7f7a391604251 to your computer and use it in GitHub Desktop.
Save JuniorTak/6527e36fbd52c46ab7e7f7a391604251 to your computer and use it in GitHub Desktop.
To force traffic to HTTPS using .htaccess file
# HTTP to HTTPS force redirection
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@JuniorTak
Copy link
Author

Add this code snippet above the # BEGIN WordPress .htaccess lines., otherwise, they will be overwritten by WordPress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment