Implementation of website sub station


At present, for business development and network promotion, general industry portal websites will open sub stations in several regions and sub industries (such as: Main Station / / www.jb51. Net /, sub station 1, sub station 2, sub station 3 Generally speaking, sub domain is used to realize sub stations. For small-scale websites, they generally share one server and database, so long as the sub domain name is resolved to the IP address of the server.

Let’s talk about how to realize the master station and sub station sharing a server and database.

Method 1: using URL rewriting technology. For example, when the user accesses the URL, he will rewrite it to a page on the server. In fact, it is the way to realize pseudo-static. Features: large flexibility, more convenient to add sub stations, more convenient to later maintenance.

Method 2: get the URL address that the user is currently visiting, and read the relevant data from the database according to the URL address to display the corresponding page effect. Features: the flexibility is poor. It is troublesome to add new sub stations (do different output on the same page). Is the later maintenance large.