首页 > 解决方案 > htaccess 重定向 301 相对路径,在需要 https 时将 url 从 https 重定向到 http

问题描述

我的 htaccess 中有简单的线条

Redirect 301 /something/ /blog/something/

如果我点击https://www.example.com/something/

它重定向到http://www.example.com/blog/something/

我想要https://www.example.com/something/https://www.example.com/blog/something/

它应该使用 https 而不是 http

标签: phpwordpress.htaccess

解决方案


尝试这个

RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} blog RewriteRule ^(.*)$ https://www.yourdomain.com/blog/$1 [R,L]


推荐阅读