11
2024
09
11:06:39

如何用.htaccess 实现域名跳转、跳转https、去掉免费虚拟机带的%1的尾巴

<IfModule mod_rewrite.c>

RewriteEngine On


RewriteCond %{HTTP_HOST} ^(hqyman\.)?ukweb\.sfgzs\.top$ [NC]    //访问https://hqyman.ukweb.sfgzs.top/

RewriteRule ^(.*)$ https://go.hqyman.cn/$1 [R=301,L]        //跳转到https://go.hqyman.cn



RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]    //https跳转

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]


RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC] 


RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]     //去掉 ?%1


</IfModule>



-------------------------


免费的虚拟机,如果要做ssl证书文件验证(百度网站https验证之类,好像现在不要求了),下面这段先临时去掉,否则验证会一直失败。  通过后再启用。


RewriteCond %{HTTP_HOST} ^(hqyman\.)?ukweb\.sfgzs\.top$ [NC]

RewriteRule ^(.*)$ https://go.hqyman.cn/$1 [R=301,L]



RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteBase /




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://hqyman.cn/post/7945.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: