首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SSL证书HTTPS通过Htaccess重定向禁用

SSL证书HTTPS通过Htaccess重定向禁用
EN

Stack Overflow用户
提问于 2018-12-01 10:13:08
回答 1查看 895关注 0票数 0

所以它重定向到https,但是由于我已经没有SSL证书了,所以需要禁用它,尝试删除Force SSL部件没有做任何相同的事情,因为force web www也没有做任何更改

另一件事是,当我去我的网站时,它会自动添加www。两次wwww.www。(域名)

这是htaccess

代码语言:javascript
复制
<IfModule mod_expires.c>
  ExpiresActive on

# Your document HTML
  ExpiresByType text/html "access plus 0 seconds"

# Media: images, video, audio
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"

# CSS and JavaScript
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
</IfModule>

Options -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]

### Force web (www) on all URLs

    RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

### Force SSL (https) on all URLs

    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

### Remove trailing slash from all URLs

    RewriteRule ^(.*)/$ $1 [R=301,L]

    RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
    RewriteRule .* ? [F,L]

    RewriteRule ^buy-([a-z0-9-]+)$ buy.php?game=$1 [NC,L,QSA]

# Redirect proper URL to SEO-friendly for buy.php

    RewriteCond %{THE_REQUEST} buy\.php\?game=([a-z0-9-]+)\s [NC]
    RewriteRule ^ buy-%1? [R=301,L]

# Internally link SEO-friendly with proper URL for buy.php

    RewriteRule ^buy-([a-z0-9-]+)$ buy.php?game=$1 [L]

# Redirect proper URL to SEO-friendly for sell.php

    RewriteCond %{THE_REQUEST} sell\.php\?game=([a-z0-9-]+)\s [NC]
    RewriteRule ^ sell-%1? [R=301,L]

# Internally link SEO-friendly with proper URL for sell.php

    RewriteRule ^sell-([a-z0-9-]+)$ sell.php?game=$1 [L]

# Redirect proper URL to SEO-friendly for testimonials.php (with pages)

    RewriteCond %{THE_REQUEST} testimonials\.php\?page=([0-9-]+)\s [NC]
    RewriteRule ^ testimonials/%1? [R=301,L]

# Internally link SEO-friendly with proper URL for testimonials.php (with pages)

    RewriteRule ^testimonials/([0-9-]+)$ testimonials.php?page=$1 [L]


# Redirect proper URL to SEO-friendly for recover.php (with code)

    RewriteCond %{THE_REQUEST} recover\.php\?code=([a-z0-9-]+)\s [NC]
    RewriteRule ^ recover/%1? [R=301,L]

# Internally link SEO-friendly with proper URL for recover.php (with pages)

    RewriteRule ^recover/([a-z0-9-]+)$ recover.php?code=$1 [L]


# Redirect proper URL to SEO-friendly for index.php (with order ID)

    RewriteCond %{THE_REQUEST} index\.php\?order=([a-zA-Z0-9-]+)\s [NC]
    RewriteRule ^ o/%1? [R=301,L]

# Internally link SEO-friendly with proper URL for index.php (with order ID)

    RewriteRule ^o/([a-zA-Z0-9-]+)$ index.php?order=$1 [L]




# Redirect proper URL to SEO-friendly for any standard page

    RewriteCond %{THE_REQUEST} \s/+(account|testimonials|contact|privacy|terms|cart|recover|faq|login|register|banned)\.php [NC]
    RewriteRule ^ /%1? [R=301,L]

# Internally link SEO-friendly with proper URL for any standard page

    RewriteRule ^(account|testimonials|contact|privacy|terms|cart|recover|faq|login|register|banned)$ $1.php [NC,L]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-01 12:40:25

很可能您的配置中有301重定向,从http重定向到https。简单地删除此重定向和重试无助于此,因为301是永久重定向的代码,这意味着浏览器将记住此重定向,即它将访问https://而不是http://,因为缓存的重定向是这么说的,甚至不会尝试访问http://

要解决这个问题,您需要同时删除重定向和清除浏览器缓存,然后可以重试。是的,这会影响到每一个访问过您网站的客户。由于无法从每个客户端清除浏览器缓存,所以最好安装一个新证书。一旦有了,您就可以将所有用户从https://重定向到http://,过一段时间,大多数浏览器都应该会收到这样的消息,即http://是最佳选择,这样您就可以删除重定向和证书。或者更好的是,只需使用https:// --有一些CA,比如让我们加密,为您提供免费的证书。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53569764

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档