您可以指定重定向仅https商店/大学的两个页面,但这不会重定向样式css / js文件。 此代码有效,但同时会出现很多错误:
Mixed Content: The page at 'https://www.example.com/shop/' was loaded over HTTPS, but requested an insecure stylesheet 'http://www.example.com/wp-includes/css/admin-bar.min.css?ver=4.4'. This request has been blocked; the content must be served over HTTPS.
如果您注释掉最后一行,则https样式正常,但在其他页面上没有重定向到http
#RewriteRule !^(shop|university)(/.*)?$ http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
.htaccess中的这段代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(shop|university)(/.*)?$ https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
RewriteCond %{HTTPS} on
RewriteRule !^(shop|university)(/.*)?$ http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
</IfModule>
答案 0 :(得分:1)
正如我在你的另一个问题中向你解释的那样:
在您的网页中,您必须使用相对于根目录的链接:
/wp-includes/css/admin-bar.min.css
或没有协议:
//www.example.com/wp-includes/css/admin-bar.min.css
但永远不要在http:
页
https