apache_conf htaccess - https ssl

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf htaccess - https ssl相关的知识,希望对你有一定的参考价值。

Options +FollowSymlinks
RewriteEngine On
#-------- way 1
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://example.com/$1 [R]

# Forcing HTTPS for a specific site
RewriteCond %{HTTP_HOST} ^ncssltest\.info$ [OR]
RewriteCond %{HTTP_HOST} ^www\.ncssltest\.info$
# or RewriteCond %{HTTP_HOST} ^ncssltest\.info$|^www\.ncssltest\.info$
RewriteRule ^(.*)$ https://www.ncssltest.info/$1 [R,L]

#-------- way 2
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#-------- way 3
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

# Enabling HTTPS for a specific subfolder
RewriteRule ^/?subfolder/(.*) https://%www.ncssltest.info/subfolder/$1 [R,L]

# Forcing HTTPS for a specific page
RewriteRule ^example\.html$ https://www.ncssltest.com/example.html [R,L]

以上是关于apache_conf htaccess - https ssl的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf [linux:.htaccess] apache的htaccess说明。 #linux #apache

apache_conf Seguridad .htaccess

apache_conf htaccess的

apache_conf 重定向htaccess

apache_conf [htaccess的]

apache_conf HtAccess重写规则