Skip to content

Instantly share code, notes, and snippets.

@tajidyakub
Created September 7, 2017 13:03
Show Gist options
  • Save tajidyakub/089c8fa7eda614ed17dfb1d802276ff2 to your computer and use it in GitHub Desktop.
Save tajidyakub/089c8fa7eda614ed17dfb1d802276ff2 to your computer and use it in GitHub Desktop.
Rewrite module apache di .htaccess untuk melakukan redirect non https ke https dan non www ke www
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment