How to establish the sub-station system in the city and find out the ideas

Source: Internet
Author: User
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.


Reply to discussion (solution)

With server rewrite can do

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.

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 unknown is directly resolved to www ...
There are two types of situations:

(1) The user directly entered the two-level domain name (2) the user entered the master station, but the program to automatically jump to the two-level 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 binds the directory, and then each province generates a folder, which writes a index.php, and the index.php calls the common common.php, and all the operations are judged in this.






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.

Well, the most earthy way is to let the user choose the region ... Well then read the different database data.

Well, the most earthy way is to let the user choose the region ... Well then read the different database data.
It's not a station, haha.

Automatically select the site according to the user's IP, but still need to access the URL through the database.

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.


Dnspod has this function.

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.

Actually, it is the concept of "cloud". Ha ha haha

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.

The point of the problem is not here, I would like to know is how to add data, the above all the landlord said is right, through the IP and then bind the city domain name, then I want to know is how the data structure, for example, I now enter the Shanghai station, it can only see the relevant information of Shanghai station
is not each table to add a field as a flag, it is too troublesome, each table to add a field to save the city

Yes, I am so in control, but the more the city information is large, it will affect the speed. No better ideas have been found yet.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.