Skip to content

Instantly share code, notes, and snippets.

@trainoasis
Created August 3, 2021 11:06
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 trainoasis/80b82b3911e55f1660be4797b70bf274 to your computer and use it in GitHub Desktop.
Save trainoasis/80b82b3911e55f1660be4797b70bf274 to your computer and use it in GitHub Desktop.
Force HTTPS (works on Nuxt JS)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@trainoasis
Copy link
Author

Notes:

  • if using Nuxt.js, put the above in .htaccess file within static folder (where favicon.png usually is by default)
  • if using elsewhere, put in project root, where your index.html is ..

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