How to establish a sub-station system in different cities and how to create a sub-station system is mainly to display and manage different contents in different cities.
I have never done it before. thank you for your consideration.
For example, when I enter Beijing, only information about Beijing is displayed on the Internet.
When you enter Shanghai, only information about Shanghai is displayed.
Please give me a thought.
Reply to discussion (solution)
Server rewrite can be used
The general idea is as follows: get the city name from the customer's IP address and use the city name to correspond to the sub-station domain name of the website.
Generally, there is an IP address Library. this database can correspond to the corresponding city name, and the city name corresponds to the second-level domain name of your website, which is resolved on the server. In this way, you can.
For example, my information Street:
Beijing: beijing.xinxijie.net
Shanghai: shanghai.xinxijie.net
Other unknown ones are directly resolved to www.xinxijie.net.
In this way, I can perform corresponding operations.
The general idea is as follows: get the city name from the customer's IP address and use the city name to correspond to the sub-station domain name of the website.
Generally, there is an IP address Library. this database can correspond to the corresponding city name, and the city name corresponds to the second-level domain name of your website, which is resolved on the server. In this way, you can.
For example, my information Street:
Beijing: beijing.xinxijie.net
Shanghai: shanghai.xinxijie.net
Other unknown ones are directly resolved to www ......
There are two scenarios:
(1) the user directly enters the second-level domain name (2) the user inputs the main site, but the program automatically jumps to the second-level domain name. Like the 58-City shopping spree
The apache server supports second-level domain name binding parameters, which are not supported by the IIS server. IIS only supports directory binding. I have done it before, but the method is stupid ?? IIS binds the directory, and each province generates a folder, which is written with an index. php, this index. php calls public common. php, and then all the operations are judged in this.
The best way is to set it from your own dns resolution, which is the most efficient. If this cannot be done, you can also create a reverse proxy server on the front end of all your servers, such as nginx. it has an extension module that is called the geo module and can be configured from here, ip segments in different regions are represented in different substations. The worst way is to judge from the program. All three methods can be implemented.
Well, the most common method is to let the user select a region... well, then read data from different databases.
Well, the most common method is to let the user select a region... well, then read data from different databases.
This is not a substation, haha.
The website of the sub-station is automatically selected based on the user's ip address, but you still need to access the inaccessible url through the database.
The best way is to set it from your own dns resolution, which is the most efficient. If this cannot be done, you can also create a reverse proxy server on the front end of all your servers, such as nginx. it has an extension module that is called the geo module and can be configured from here, ip segments in different regions are represented in different substations. The worst way is to judge from the program. All three methods can be implemented.
Dnspod has this function.
The best way is to set it from your own dns resolution, which is the most efficient. If this cannot be done, you can also create a reverse proxy server on the front end of all your servers, such as nginx. it has an extension module that is called the geo module and can be configured from here, ip segments in different regions are represented in different substations. The worst way is to judge from the program. All three methods can be implemented.
It is actually a concept of "cloud. Hahaha
There are two methods:
1. you can use rewrite
2. obtain the city based on the customer's IP address, and then use the city name to go to your database to find the sub-station domain name corresponding to your website.
The focus of the problem is not here. what I want to know most is how to structure the data. all the above mentioned are correct. then, bind the city domain name through the IP address, what I want to know most is how the data should be structured. for example, if I enter the Shanghai site, I can only see the relevant information of the Shanghai site.
Is it too troublesome to add a field to each table to save the city?
Yes, that's what I control. However, the more information the city has, the more information it has, the more speed it will have. No better ideas have been found.