[英]301 redirect all assets from http to https
I've searched and tried but I can't seem to find an answer on how to 301 redirect all assets when moving my http site to full https. 我已经搜索并尝试过,但是在将http网站移至完整https时,如何找到301重定向所有资产的方法似乎找不到答案。
I'm looking for a way to either use .htaccess or httpd.conf to 301 redirect all assets (images, pdf, videos, js, css, .txt, etc) from http to https. 我正在寻找一种使用.htaccess或httpd.conf到301的方法,将所有资产(图像,pdf,视频,js,css,.txt等)从http重定向到https。
The full structure of both http and https remain the same. http和https的完整结构保持不变。
I would appreciate any guidance on this topic. 我希望您能对此主题提供任何指导。
Thanks William 谢谢威廉
# Checking if HTTPS is enabled for current page
RewriteCond %{HTTPS} !=on
# Redirecting any non-HTTPS document by this URL to HTTPS URL
RewriteRule (.*)\.(?:jpe?g|gif|bmp|png|tiff|css|js|pdf))$ https://%{SERVER_NAME}/$1.$2 [R=301,L]
Taken from here: https://wiki.apache.org/httpd/RewriteHTTPToHTTPS 从这里获取: https : //wiki.apache.org/httpd/RewriteHTTPToHTTPS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.