Answer the question
In order to leave comments, you need to log in
Redirect from http to https locally does not allow the server to start, how to fix it?
Hello, there is a site written in php
, when you try to deploy it locally, it redirects to https and the browser gives an error (Error when establishing a secure connection) site, now it works if you remove htaccess.
RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
RewriteRule ^vidguky/video/page-([0-9]+)(/?) index.php?a=comments&video&page=$1
RewriteRule ^vidguky/page-([0-9]+)(/?) index.php?a=comments&page=$1
RewriteRule ^vidguky(/?) index.php?a=comments
RewriteRule ^kontakty(/?) index.php?&a=page&name=kontakty
RewriteRule ^pronas(/?) index.php?&a=page&name=pronas
RewriteRule ^znighky(/?) index.php?&a=page&name=znighky
RewriteRule ^vakansii(/?) index.php?&a=page&name=vakansii
RewriteRule ^garanty(/?) index.php?&a=page&name=garanty
RewriteRule ^faq(/?) index.php?&a=page&name=faq
RewriteRule ^message/$ _php/order.php [QSA,L]
RewriteRule ^search/$ index.php?a=search [QSA,L]
RewriteRule ^statti/(.*)/ index.php?a=articles&name=$1
RewriteRule ^statti/page-([0-9]+)(/?) index.php?a=articles&page=$1
RewriteRule ^statti(/?) index.php?a=articles
RewriteRule ^services/([0-9]+)-(.*)/search([0-9]+) index.php?a=services&id=$1&search=$3
RewriteRule ^services/([0-9]+)-(.*) index.php?a=services&id=$1
RewriteRule ^services(/?) index.php?a=services
RewriteRule ^santehniky(/?) index.php?a=services&id=1
RewriteRule ^vyklyk-poslugy-santehnika(/?) index.php?a=services&id=15
RewriteRule ^prochistka-kanalizatsii-trub(/?) index.php?a=services&id=37
RewriteRule ^electryky(/?) index.php?a=services&id=4
RewriteRule ^vyklyk-poslugy-elektryka(/?) index.php?a=services&id=24
RewriteRule ^stolyary(/?) index.php?a=services&id=5
RewriteRule ^vantazhnyky-perevezennya-pidsobnyky(/?) index.php?a=services&id=6
RewriteRule ^vantazhni-perevezennya(/?) index.php?a=services&id=7
RewriteRule ^remont-pralnyh-mashyn-holodylnykiv(/?) index.php?a=services&id=8
RewriteRule ^remont-gazovogo-kotla-kolonky(/?) index.php?a=services&id=9
RewriteRule ^remont-kvartyr-ofisiv(/?) index.php?a=services&id=10
RewriteRule ^avariyne-vidkryttya-dverey(/?) index.php?a=services&id=11
RewriteRule ^prybyrannya-kvartyr-ofisiv(/?) index.php?a=services&id=12
RewriteRule ^zvaryuvalni-roboty(/?) index.php?a=services&id=13
RewriteRule ^remont-trenazheriv(/?) index.php?a=services&id=14
RewriteRule ^price/([0-9]+)-(.*) index.php?a=price&cat_id=$1
RewriteRule ^price(/?) index.php?a=price
RewriteRule ^opisy/([0-9]+)-(.*) index.php?a=texts&id=$1
RewriteRule ^opisy/cat/([0-9]+)-(.*) index.php?a=texts&cat_id=$1
RewriteRule ^opisy(/?) index.php?a=texts
## AJAX
RewriteRule ^ajax-(.*) _lib/ajax/$1.php
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php54” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php54 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
Answer the question
In order to leave comments, you need to log in
RewriteCond %{HTTP_HOST} !^192\.168\.33\.33$ [NC] # тут адрес локального сервера
# вставить перед строчкой
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
It is impossible to make a certificate for localhost, more precisely, you will have to load a self-signed certificate into the browser, but browsers will still issue a warning, because otherwise it will be a huge hole.
The solution is to register the domain under which you have issued a certificate in hosts to the local ip (127.0.0.1 or from the local network) and install it in the local web server. Those. you will work with the same domain as the combat one, but locally it will go to the local site and not to the combat one (to go back to the combat one, remove the entry from hosts)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question