簡體   English   中英

301在htaccess中將https(舊站點)重定向到http(新站點)

[英]301 redirect https (old site) to http (new site) in htaccess or otherwise

我必須在這里閱讀每一個答案100次,但是我仍然無法使它正常工作(也許是我的VPS),但是我也很討厭我的主機,他們也無法破解它。

舊網站https://www.olddomain.co.uk我想301到新網站http://newdomain.com

我已經嘗試了所有可以找到的htaccess代碼/規則,但仍然沒有用。

這些是我下面一直在使用的2個想法,但是htaccess似乎無法識別SSL,因此運行規則進行重定向。

RewriteEngine on

# First rule - if this is an SSL connection, then redirect
# to http://enginecoreplugs.com then stop processing other rules
RewriteCond %{HTTPS} on
RewriteRule (.*) http://enginecoreplugs.com/$1 [R=301,L]

# Second rule - all other requests, redirect to http://enginecoreplugs.com.
RewriteRule (.*) http://enginecoreplugs.com/$1 [R=301,L]

要么

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

如果有幫助,舊網站我想301 = https://www.enginecoreplugs.co.uk新網站= http://enginecoreplugs.com

提前致謝!!

我一切都正確。

最終在轉發https版本的主機上出現了一些愚蠢的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM