Focus on cloud service provider activities
Notes on website operation and maintenance

OneinStack script LAMP (Apache) settings force HTTPS and 301 jump

OneinStack, like the familiar LNMP, is a well-known and powerful Linux server WEB installation script. When using OneinStack LNMP (Nginx) environment, we can set forced HTTPS and 301 jump in the installation wizard process, but when installing LAMP (Apache), we can install SSL, but the wizard does not prompt for forced setting and 301 jump.

Because the difference between the Apache environment and the Nginx configuration file cannot be set compulsorily, because the former will be set in the root directory of the website. htaccess file. If we set the domain name when we install it, then when we use pseudo static, some programs are automatically generated, which is easy to conflict or be replaced. Lao Zuo guessed that the reason why the author didn't install the wizard in the Apache environment was because of this intention.

 OneinStack script LAMP (Apache) settings force HTTPS and 301 jump

Since there are no settings, if our website needs to be set, we need to complete the settings in the root directory of the website. htaccess file after the website program is installed.

RewriteEngine On
RewriteCond %{HTTP_HOST} ! ^www.laobuluo.com$ [NC] RewriteRule ^(.*)$ https://www.laobuluo.com/ $1 [L,R=301] RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.laobuluo.com/ $1 [L,R=301]

Change the domain name in the script to the site domain name you need, and then replace it to the. htaccess file of the current site. You can achieve 301 jump and force the HTTPS certificate form.

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » OneinStack script LAMP (Apache) settings force HTTPS and 301 jump