Last active
August 1, 2020 11:15
-
-
Save bernard-ng/18137ec2564ec6f4b9b3c635e0405104 to your computer and use it in GitHub Desktop.
angular - ionic .htaccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c > | |
RewriteEngine on | |
RewriteOptions inherit | |
# let's encrypt ssl | |
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$ | |
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ | |
RewriteRule ^.well-known/acme-challenge - [L] | |
# redirect to no-www | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
# https redirect | |
RewriteCond %{HTTPS} !=on | |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# If an existing asset or directory is requested go to it as it is | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d | |
RewriteRule ^ - [L] | |
# If the requested resource doesn't exist, use index.html | |
RewriteRule ^ /index.html | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment