Home .htaccess redirection with https: // www on https without www

redirection with https: // www on https without www

Author

Date

Category

How to configure forwarding with https:// www on https without www?


Answer 1, Authority 100%

Try so

rewriteengine on
RewriteCond% {Server_PORT} ^ 443 $ [OR]
RewriteCond% {https} on
Rewritecond% {http_host} ^ www \. (. +) [NC]
Rewriterule. * Https: //% 1% {Request_uri} [R = 301, L, QSA]

or

rewriteengine on
RewriteCond% {http_host} ^ www \. [NC]
RewriteCond% {Server_PORT} ^ 443 $ [OR]
RewriteCond% {https} on
Rewriterule. * Https: //domure.ru% {Request_uri} [R = 301, L, QSA]

Answer 2, Authority 25%

solved the problem like this: Created a separate domain with www , received a certificate on it and in the WWW domain through .htaccess added redirect

rewriteengine on
RewriteCond% {http_host}! ^_name_name \ .ru $ [NC]
Rewriterule ^ (. *) $ HTTPS: //IMA_Saita.ru/$1 [L, R = 301]

a year later, for unknown reasons, an error appeared when moving to HTTP and I did this:

rewriteengine on
Rewritecond% {https}! = ON
Rewriterule ^ (. *) $ Https: //% {http_host} / $ 1 [R = 301, L]

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions