Answer the question
In order to leave comments, you need to log in
How to create an https redirect rule for htaccess?
There is a React web application on the subdomain foo.site.ru
It is
necessary that when accessing it via http, there should be a redirect to https
This redirect must be combined with the existing code (it directs all requests like foo.site.ru/page to index.html)
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
Answer the question
In order to leave comments, you need to log in
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question