.htaccess 强制 http 到 https 复杂结构
.htaccess force http to https complex structure
复杂结构需要将变量文件夹下的变量文件重定向到https
第一
example.com/business/variable-folders/variable-file
例如
example.com/business/business-manager/2344642
example.com/business/company-lawyer/146785
example.com/business/cleaning/5876441235
第二
example.com/variable-folders/variable-file
例如
example.com/business-manager/local-state
example.com/motel/western-state
到目前为止,我一直在使用下面的配置,但它没有说明所需的结构:
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !(/$)
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) example.com/ [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ example.com/ [R,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ example.com/business^([^/]+)/ [R,L]
将以下代码添加到
中的.htaccess文件中
1-根文件夹
2-example/business/文件夹
3- 例如每个文件夹。com/variable-folders/variable-file 每个子文件夹
重写引擎开启
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
复杂结构需要将变量文件夹下的变量文件重定向到https
第一
example.com/business/variable-folders/variable-file
例如
example.com/business/business-manager/2344642
example.com/business/company-lawyer/146785
example.com/business/cleaning/5876441235
第二
example.com/variable-folders/variable-file
例如
example.com/business-manager/local-state
example.com/motel/western-state
到目前为止,我一直在使用下面的配置,但它没有说明所需的结构:
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !(/$)
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) example.com/ [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ example.com/ [R,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ example.com/business^([^/]+)/ [R,L]
将以下代码添加到
中的.htaccess文件中1-根文件夹
2-example/business/文件夹
3- 例如每个文件夹。com/variable-folders/variable-file 每个子文件夹
重写引擎开启 RewriteCond %{HTTPS} !on RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]