【问题标题】:redirect https to http from google search从谷歌搜索将 https 重定向到 http
【发布时间】:2016-10-19 10:15:13
【问题描述】:

您好,我从我的网站上删除了我的 ssl 证书。我修复了数据库显示 HTTPS 并从 htaccess 文件中删除了必要的行。但现在 - 任何人如何尝试进入我的 wordpress 网站都会收到一条错误消息(因为 ssl ...)我如何将用户从 HTTPS 转发到 HTTP?

下面的htaccess:

text/x-generic .htaccess ( ASCII text )

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{SERVER_PORT} 80 
# RewriteRule ^(.*)$ https://www.*****.com/$1 [R,L]
# </IfModule>


<IfModule mod_headers.c>    
Header add Access-Control-Allow-Origin "*" 
</IfModule>

Header unset Pragma
FileETag None
Header unset ETag

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##


<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

【问题讨论】:

    标签: wordpress .htaccess ssl


    【解决方案1】:

    如果您通过 http 访问您的网站,它会起作用吗?只是 Google 的结果仍然显示为 SSL?

    我确定你有,但你能确认你已经改变了吗:

    设置 > 常规设置 > WordPress 地址 (URL)

    设置 > 常规设置 > 站点地址 (URL)

    【讨论】:

    • 该网站在 http 上运行良好。问题是当我试图通过谷歌进入网站时,那里有一个 ssl 连接。
    • 我检查了我的wordpress,地址是HTTP。
    【解决方案2】:

    如果您只想强制所有 HTTPS 连接到 HTTP,那么您可以在 .htaccess 中使用以下内容

    RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

    基本上,这就是说,如果您的网站打开并且https 处于打开状态,那么它会将其转换为http

    【讨论】:

    • 但我的网站禁用了 HTTPS,我的证书已过期
    • 您收到的实际错误消息是什么?
    • 我的网站与 cloudflare 同步。我收到的消息是来自 cloudflare 服务的网站缓存版本。
    猜你喜欢
    • 2016-07-11
    • 2016-09-05
    • 1970-01-01
    • 2014-03-13
    • 1970-01-01
    • 2012-08-19
    • 1970-01-01
    • 2019-12-17
    • 2018-07-14
    相关资源
    最近更新 更多