[英]redirect page(https) to external URL(http) with htaccess
我想將https://www.siteone.com/testpage-es.html重定向到http://newsite.com
當我在htaccess測試器( https://htaccess.madewithlove.be/ )中測試代碼時,它顯示以下結果。 “新的URL為http://newsite.com:443/ ”
我的代碼如下。
RewriteCond%{HTTP_HOST} ^ www.siteone.com $ [NC]
RewriteRule ^ testpage-es.html $ http://newsite.com [L,R = 301,NC]
有人可以幫我擺脫“:443 /”部分嗎?
將端口添加到您的重寫
RewriteCond %{HTTP_HOST} ^(www\.)?siteone\.com$ [NC]
RewriteRule ^testpage-es\.html$ http://newsite.com:443 [L,R=301,NC]
但是SSL / HTTPS的默認端口為443,因此規則應看起來(使用https://而不是端口號)
RewriteCond %{HTTP_HOST} ^(www\.)?siteone\.com$ [NC]
RewriteRule ^testpage-es\.html$ https://newsite.com [L,R=301,NC]
終於,我找到了答案。 這只是與https網站的htaccess檢查器有關的問題。 我上面提到的代碼在實時環境中正常工作。 (我不確定是否可以100%地確定要在實時網站上進行檢查。但是,它在實時環境中效果很好。)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.