wordpress - 为我的 WordPress 网站强制使用 https...特定子域除外

标签 wordpress .htaccess encryption https

我正在尝试弄清楚如何排除 WordPress 网站的一个特定子域被强制使用 HTTPS。

这是我的 .htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # HTTPS by default
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>

此代码完美地执行 HTTPS。现在,我希望我的 download.domain.com 保持纯 HTTP,而不是加密。我尝试了很多很多方法,但没有找到有效的方法。

谢谢。

最佳答案

# HTTPS by default except for download.domain.com
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !=download.domain.com
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

这应该可以解决问题。

当您进行测试时,请注意浏览器会缓存 301 重定向 - 因此您可能会拒绝有效的解决方案,因为您的浏览器欺骗了您。确保打开浏览器开发工具并禁用请求缓存。

关于wordpress - 为我的 WordPress 网站强制使用 https...特定子域除外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41502701/

相关文章:

php - WordPress ajax 发布到同一页面 - 仅具有管理面板访问权限

css - 操纵 wordpress "the_content"

shell - cryptsetup luks格式错误: Requested offset is beyond real size of device/dev/loop1

c++ - 使用 ZeroMQ 加密数据的建议

ruby-on-rails - 在内存 Ruby/Rails 中压缩和加密文件

html - 通过在不同服务器上托管图像来提高加载性能

php - AJAX 不会响应 .htaccess 中的 POST php

html - 通过htaccess替换&lt;title&gt;&lt;/title&gt;?

regex - 301 重定向仅适用于 .asp,不适用于 .aspx

php - WooCommerce:检查商品是否已在购物车中