gpt4 book ai didi

.htaccess - 通过 Htaccess 禁用 SSL 证书 HTTPS 重定向

转载 作者:太空宇宙 更新时间:2023-11-03 14:29:55 27 4
gpt4 key购买 nike

因此它重定向到 https,但由于我不再拥有 SSL 证书,因此需要将其禁用,尝试删除 Force SSL 部分对强制 web www 没有做任何相同的事情也没有做任何更改

另一件事是,当我访问我的网站时,它会自动添加 www.两次这样 wwww.www.(domainname)

这是htaccess

<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]

最佳答案

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

要解决此问题,您需要删除重定向并清除浏览器缓存 - 然后您可以重试。是的,这会影响访问过您网站的每个客户。由于您无法清除每个客户端的浏览器缓存,因此最好安装一个新证书。一旦你有了一个,你就可以将所有用户从 https:// 重定向到 http://,过了一会儿,大多数浏览器应该已经收到消息 http:// 是要走的路,这样您就可以删除重定向和证书。或者更好的是,只需使用 https:// - 有像 Let's Encrypt 这样的 CA 可以为您提供免费证书。

关于.htaccess - 通过 Htaccess 禁用 SSL 证书 HTTPS 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53569764/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com