Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Can the virtual host put multiple websites?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about whether the virtual host can be put on multiple websites. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Generally speaking, the requirement of service providers is that a virtual host can only store one site, and small webmasters and bloggers generally buy a virtual host in 500M-1G space.

But to prepare a new site, and do not want to buy a new virtual host, you can try to build a multi-site site on a virtual host. The simplest thing is to create different directories, create wp and em in the root directory to hold the WordPress blog and emlog blog, and then access it through the domain name / subdirectory name.

To access different sites by accessing different domain names, the .htaccess rule can be used in the site space.

First, create a new .htaccess file (you can use TXT to store any name on the win computer, and it is also feasible to change the name to .htaccess after uploading the virtual host)

RewriteEngine OnRewriteBase / # bind pic.cncat.cn to subdirectory picRewriteCond% {HTTP_HOST} ^ pic\ .cncat\ .cn $[NC] RewriteCond% {REQUEST_URI}! ^ / pic/RewriteRule ^ (. *) $pic/$1?Rewrite [LQuery QSA] # can bind multiple You only need to repeat the previous three lines of code and change the domain name and directory name to OK. # bind video.cncat.cn to the subdirectory videoRewriteCond% {HTTP_HOST} ^ video\ .cncat\ .cn $[NC] RewriteCond% {REQUEST_URI}! ^ / video/RewriteRule ^ (. *) $video/$1?Rewrite [LQuery QSA] # can bind multiple. You only need to repeat the previous three lines and change the domain name and directory name to OK.

Create the above files and store them in the root directory of the virtual host

Next, you can continue to put different .htaccess files in each subdirectory.

RewriteEngine OnRewriteBase / # only bound domain names are allowed to access RewriteCond% {HTTP_HOST}! ^ pic\ .cncat\ .cn $[NC] RewriteRule (. *) http://pic.cncat.cn/$1 [Lmaine pic 301] # processing of directories with the same name under the bound directory RewriteCond% {REQUEST_URI} ^ / pic\ / [NC] RewriteCond% {QUERY_STRING}! ^ (. *)? RewriteRewriteRule ^ (. *) $/% {REQUEST_URI} /% {REQUEST_URI} / $1?Rewrite [LMQSA]

Just modify the directory and domain name according to the directory name. Under the video folder, change the above to video.

Put a copy of the root directory, subdirectory put a corresponding subdirectory to deal with the line! Be careful to modify your domain name and directory name.

However, for the stable operation of the website, it is best to build a site with a host.

The above is whether the virtual host shared by the editor can put more than one website. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report