How to establish the sub-station system in the city and find out the ideas
Want to do a sub-station system, mainly for different cities to display and manage different content.
Have not done, beg a train of thought, thank you all.
For example, I entered Beijing, this online only shows the relevant information in Beijing.
In Shanghai, only the relevant information is displayed in Shanghai.
I beg you to give me a thought.
------Solution--------------------
With server rewrite can do
------Solution--------------------
The general idea is this: through the customer's IP address to obtain the city name, through the city name to correspond to their own site of the sub-station domain name.
Generally have an IP address library, this library can correspond to the corresponding city name, the city name corresponding to its own site level two domain name, on the server to do a good job of parsing. That's all you can do.
Like my info-street:
Beijing: Beijing.xinxijie.net
Shanghai: shanghai.xinxijie.net
Other unknowns are directly resolved to www.xinxijie.net.
That's how I can do that.
------Solution--------------------
Reference: The General
idea is this: through the customer's IP address to obtain the city name, through the city name to correspond to their own site's sub-station domain name.
Generally have an IP address library, this library can correspond to the corresponding city name, the city name corresponding to its own site level two domain name, on the server to do a good job of parsing. That's all you can do.
Like my info-street:
Beijing: Beijing.xinxijie.net
Shanghai: shanghai.xinxijie.net
Other unknown is directly resolved to www
...
There are two types of situations:
(1) Users directly enter the level two domain name
(2) The user input is the master station, but the program to automatically jump to the level two domain name. Like 58 in the same city.
The Apache server supports two-level domain name binding parameters, IIS server does not support, and IIS supports only bound directories. I've done it before, but it's a stupid method. ――iis bind the directory, and then each province generates a folder, which writes a index.php, which index.php calls the common common.php, and then all the operational judgments are in this.
------Solution--------------------
The best way is to set it up from your company's own DNS resolution, which is the most efficient. If this is not possible, you can also make a reverse proxy server in front of all of your servers, such as Nginx, it has an extension module called Geo Module, can be configured from here, different regions of the IP segment proxy to different sub-stations. The worst way is to judge from the program. Three ways can be achieved.
------Solution--------------------
Well, the most earthy way is to let the user choose the region ... Well then read the different database data.
------Solution--------------------
Automatically select the site according to the user's IP, but still need to access the URL through the database.
------Solution--------------------
Citation: The
best way is to set it from your company's own DNS resolution, which is the most efficient. If this is not possible, you can also make a reverse proxy server in front of all of your servers, such as Nginx, it has an extension module called Geo Module, can be configured from here, different regions of the IP segment proxy to different sub-stations. The worst way is to judge from the program. Three ways can be achieved.
Dnspod has this function.
------Solution--------------------
Citation: The
best way is to set it from your company's own DNS resolution, which is the most efficient. If this is not possible, you can also make a reverse proxy server in front of all of your servers, such as Nginx, it has an extension module called Geo Module, can be configured from here, different regions of the IP segment proxy to different sub-stations. The worst way is to judge from the program. Three ways can be achieved.
Actually, it is the concept of "cloud". Ha ha haha
------Solution--------------------
Generally two ways:
1, using rewrite can do
2, according to the customer's IP address to obtain the city, and then through the city name to your library to find the corresponding site of the sub-station domain name.