Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess可在某些页面上控制HTTPS_.htaccess_Http_Mod Rewrite_Https_Rewrite - Fatal编程技术网

.htaccess可在某些页面上控制HTTPS

.htaccess可在某些页面上控制HTTPS,.htaccess,http,mod-rewrite,https,rewrite,.htaccess,Http,Mod Rewrite,Https,Rewrite,我正在使用htaccess将某些页面重定向到htaccess。我使用的代码是 RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /core/marketing/editprofile RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L] 该页面正在重定向到/core/marketing/editprofile,但在此之后,其他页面不会重定向回http 请告诉我,我可以同时启用http

我正在使用htaccess将某些页面重定向到htaccess。我使用的代码是

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /core/marketing/editprofile
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
该页面正在重定向到
/core/marketing/editprofile
,但在此之后,其他页面不会重定向回http


请告诉我,我可以同时启用https到http重定向吗?

您必须对其他页面执行相反的操作:

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /core/marketing/editprofile
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !/core/marketing/editprofile
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]