{"id":1772,"date":"2023-03-04T19:51:17","date_gmt":"2023-03-04T19:51:17","guid":{"rendered":"https:\/\/summersnow.eu.org\/?p=1772"},"modified":"2023-03-05T14:36:25","modified_gmt":"2023-03-05T14:36:25","slug":"automatically-jumping-from-the-domain-without-www-to-the-domain-with-www-on-bt-panel-settings","status":"publish","type":"post","link":"https:\/\/summersnow.eu.org\/?p=1772","title":{"rendered":"Automatically Jumping from the Domain without WWW to the Domain with WWW on BT Panel Settings"},"content":{"rendered":"\n<p>Last week, I applied for a free VPS host that needs to be manually renewed every 7 days. The speed of installing BT Panel is also very good. Then I installed the WordPress blog program, added a domain with WWW, and moved all the content of the previous blog to it. I added the domain and SSL on CloudFlare. After everything was ready, I found that the blog homepage could be normally opened when entering the domain with WWW in the browser address bar, but once I entered the domain without WWW, a 404 Not Found nginx page appeared. What is the reason then?<\/p>\n\n\n\n<p>After using Google search, I found that there are many solutions to this problem, but they are all modified for the Nginx configuration file, such as: &#8220;<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/51673748\" data-type=\"URL\" data-id=\"https:\/\/zhuanlan.zhihu.com\/p\/51673748\" target=\"_blank\" rel=\"noreferrer noopener\">\u6211\u7684Nginx \u914d\u7f6e\uff0c\u57df\u540d\u4e0d\u5e26www\u8df3\u8f6c\u5230www\uff0chttp\u5f3a\u5236\u8df3\u8f6chttps\uff0c\u8fd9\u4e9b\u90fd\u6709\u4e86<\/a>&#8221; adding the following statement in the configuration file of nginx.conf:<\/p>\n\n\n\n<p>server {<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; listen 80;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_name www.your-domain.com;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewrite ^(.*)$&nbsp; https:\/\/www.your-domain.com$1 permanent;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>For example with a question post in the following forum, &#8220;<a href=\"https:\/\/www.rhw.biz\/thread-122537-1-1.html\" data-type=\"URL\" data-id=\"https:\/\/www.rhw.biz\/thread-122537-1-1.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u6c42\u6559\uff1a\u7f51\u7ad9\u4e0d\u5e26www\uff0c\u9875\u9762\u63d0\u793a404<\/a>&#8220;, someone answered as follows:<\/p>\n\n\n\n<p>\u901a\u8fc7\u4fee\u6539\/usr\/local\/nginx\/conf\/vhost\u4e0b\u9762\u4e3b\u673a\u7684conf\uff0c\u591a\u6dfb\u52a0\u4e00\u4e2a\u4e0d\u5e26www\u7684\u57df\u540d\u5c31\u597d\u4e86\u3002\u5199\u6210\u8fd9\u79cd\u6837\u5b50\uff1a<\/p>\n\n\n\n<p>server {<\/p>\n\n\n\n<p>listen 80;<\/p>\n\n\n\n<p>server_name nginx.org www.nginx.org;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>However, I failed after similar operations on BT Panel. Inspired by an article &#8220;<a href=\"https:\/\/www.huanjingba.com\/meiyouzhaodaozhandian.html\" data-type=\"URL\" data-id=\"https:\/\/www.huanjingba.com\/meiyouzhaodaozhandian.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u539f\u56e0\uff1a\u60a8\u7684\u8bf7\u6c42\u5728Web\u670d\u52a1\u5668\u4e2d\u6ca1\u6709\u627e\u5230\u5bf9\u5e94\u7684\u7ad9\u70b9\u7684\u89e3\u51b3\u65b9\u6cd5<\/a>&#8220;, I modified the &#8220;Website-Settings-Configuration File&#8221; tab in the background of BT Panel by adding the domain without WWW according to the above format (as shown in the red box in the figure below) and thus solved the problem.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"517\" src=\"https:\/\/summersnow.eu.org\/wp-content\/uploads\/2023\/03\/\u5b9d\u5854\u9762\u677f\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6\u622a\u56fe.jpg\" alt=\"\" class=\"wp-image-1773\" srcset=\"https:\/\/summersnow.eu.org\/wp-content\/uploads\/2023\/03\/\u5b9d\u5854\u9762\u677f\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6\u622a\u56fe.jpg 785w, https:\/\/summersnow.eu.org\/wp-content\/uploads\/2023\/03\/\u5b9d\u5854\u9762\u677f\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6\u622a\u56fe-300x198.jpg 300w, https:\/\/summersnow.eu.org\/wp-content\/uploads\/2023\/03\/\u5b9d\u5854\u9762\u677f\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6\u622a\u56fe-768x506.jpg 768w, https:\/\/summersnow.eu.org\/wp-content\/uploads\/2023\/03\/\u5b9d\u5854\u9762\u677f\u7f51\u7ad9\u914d\u7f6e\u6587\u4ef6\u622a\u56fe-230x151.jpg 230w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Last week, I applied for a free VPS host that needs to  &#8230;.&nbsp;&nbsp;<a class=\" special\" href=\"https:\/\/summersnow.eu.org\/?p=1772\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[117,118,116],"class_list":["post-1772","post","type-post","status-publish","format-standard","hentry","category-internet","tag-bt-panel","tag-nginx","tag-redirection"],"views":313,"_links":{"self":[{"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1772"}],"version-history":[{"count":3,"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1772\/revisions"}],"predecessor-version":[{"id":1777,"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1772\/revisions\/1777"}],"wp:attachment":[{"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summersnow.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}