Co-branding of network services via Apache configuration rewrite

Source: Internet
Author: User
Tags regular expression web services hosting

This paper discusses how to use Apache rewrite module, rewrite the URL branding information into JSP page request parameters, and then through JSP for the session object operation to save and extract the user's brand information, and finally show the custom U The technical scheme of I is to realize the demand of co-branding users in the network hosting service. Read this article needs to have a certain preliminary understanding of Apache and JSP.

What is co-branding

Nowadays, many websites provide "hosting" service (Hosting) for enterprise users in the way of network service, typical applications such as Gmail mailbox hosting service. If you have a company called, you can register your company's mailbox domain name through Gmail, and visit the following link to the company email domain name:

And in this page with your company's domain name, you can create your own mailboxes, such as Note that this email address is not Therefore, for small and medium-sized enterprises, this kind of managed mailbox service is like providing a physical company's own mail server and using its own company's domain name. This service is actually implemented through managed services on the Google Cloud server. On the other hand, based on the business image, many small and medium-sized companies in the use of cheap or free hosting services, but also want to use their own company LOGO or name, such as the above Gmail example, through the link to enter the page, you can display the name of the user company and logo, So that the user to negotiate external customers also feel like access to the user company's own mailbox services, we have this from the managed services derived from the user needs called "Web service co-branding", that is, Network services brand Union.

The main problem that co-branding needs to solve is to identify the network service which the user wants to visit by the different URLs of the user's access, and then the relevant elements of the brand's text, pictures, Logo,flash and so on are used to provide the UI elements, even page layouts. Of course this customized service is based on the customer's purchase or free access to the Internet service provider.

This paper mainly explains a kind of technical means to realize this kind of customization service. This article assumes that users are already familiar with some of the software and techniques for developing Web services: Apache, an open source Web server for the Apache Software Foundation, runs in most computer operating systems and is one of the most popular Web server-side software because it is widely used across platforms and security. JSP (full name JavaServer pages) is a technical standard for web pages that enable software developers to respond to client requests and dynamically generate HTML, XML, or other format documents, initiated by Sun Microsystems and many companies. JSP technology is in the Java language as a scripting language, JSP Web pages for the entire server-side Java Library unit provides an interface to serve the HTTP application. This article's webpage example uses the JSP realization, certainly the reader can also easily think how uses the PHP or other webpage development language to implement the example function.

This article includes three parts: Apache configuration and URL jump, JSP extraction and save branding information, JSP dynamic display of different UI elements.

Apache Configuration and URL jumps

As I mentioned earlier, the first question that co-branding needs to address is how to identify the network services that a user is going to visit under which brand (brand) through different URLs accessed by the user. To solve this problem, a technical means is to think of using the Apache server, the Apache server listens to the HTTP port of the service domain, when the user accesses the http://www. network Services, the user's browser will first send the request to the Apache server, then the Apache server is distributed to the processing of the request module and finally returned to the user should see the page to the client browser. Therefore, we use the Apache rewrite module, we can do when the user's URL request, identify the user is want to access the brand of network services, and then convert the request to a URL with brand information forwarded to a specific processing page.

First determine which Apache version you are using, and whether the Mod_rewrite module is loaded. and whether the Mod_rewrite module is loaded. Mod_rewrite is an Apache module that allows the server to manipulate the requested URL. The incoming URLs are checked against a series of rules, and a regular expression is included in the rule to detect a particular format. If a format is found in the address and the appropriate conditions are met, the format is replaced by an alternate string or an action.

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: 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.