Answer the question
In order to leave comments, you need to log in
Why did the redirect suddenly become circular?
Once upon a time there was an ordinary .htaccess
RewriteEngine on
RedirectMatch 404 /\.git
RedirectMatch 404 /composer\.
RedirectMatch 404 /.bowerrc
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
public function beforeAction($action)
{
if(!Yii::$app->request->getIsSecureConnection()){
$redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
return $this->redirect($redirect,301);
}
return parent::beforeAction($action);
}
Answer the question
In order to leave comments, you need to log in
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question