【问题标题】:Disable https for a single .php page on my wordpress site在我的 wordpress 网站上为单个 .php 页面禁用 https
【发布时间】:2016-11-29 10:29:16
【问题描述】:

我的 wordpress 网站上有一个 search.php 页面,我不想使用 https,因为它会产生混合内容错误。不确定如何仅在该特定页面上禁用 https。我在stackforum上搜索并得到以下答案:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} ^off$
RewriteCond %{REQUEST_URI} !exp\.php$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

不确定它是否适合我!我需要添加上面的代码还是替换任何代码

【问题讨论】:

  • 修复混合内容错误,这是解决您问题的唯一方法。在一个页面上禁用 HTTPS 绝对是不好的做法(而且我很愚蠢),因为它包含混合内容。你只是懒得解决真正的问题。当 HTTPS 被强制执行时,我很高兴。
  • 网站使用 iframe 显示来自其他网站的内容。我正在学习解决混合内容错误,因为页面没有根据需要显示结果。作为一个非技术人员,我正在尽力解决这个问题。

标签: php wordpress https


【解决方案1】:
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^\/yourfile.php$
RewriteRule (.*) http://yoursite.com/yourfile.php [R = 301,L]

将此代码添加到您的 htaccess 底部应该可以工作。

【讨论】:

  • 嗨,我在 htaccess 文件中添加了上述代码,但收到 500 内部服务器错误 RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME } !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule 。 /index.php [L] RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} ^\/yourfile.php$ RewriteRule (.*) yoursite.com/yourfile.php [R = 301,L]
  • 如果您的 htaccess 代码包含任何具有 L 的规则,您应该删除 L 关键字。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-19
相关资源
最近更新 更多