Urlrewriter in Java (URL rewriting)_ Source download

Recently, I used URL rewriting in a project.

How to enhance the readability of the address in your website and let the search engine quickly include it in your website, which requires you to beautify the address of your web page,

This is what we often call URL rewriting technology. Many familiar servers may provide URL rewriting technology. In the past, Apache was the most used,

Some URLs of JBoss servers are rewritten, but their configuration is troublesome and their performance is not very good. Now we have a specific open source framework

To complete the URL rewriting task. Today I want to introduce the URL rewriter. It is relatively simple to use and the configuration is quite simple and clear.

Let's first briefly understand what benefits URL rewriting can bring to your website.

First: it is conducive to the crawling of search engines, because most search engines are still weak in crawling dynamic pages, and they prefer to crawl some static pages.

Most of the data on our current page is displayed dynamically. This requires us to turn dynamic pages into static pages, which is conducive to the capture of search engines.

Second: make it easier for users to understand. Few users care about the page address of your website, but it is still necessary to enhance the readability of general large and medium-sized websites. This will make your website more perfect.

Third: the implementation of hiding technology. We can hide the technology through URL rewriting. It will not expose the technology you use and provide convenience for some enthusiasts who want to attack your website.

Fourth: it can be easily reused and improve the portability of the website. If we change the background method, we can ensure that the front page does not need to be changed. This improves the portability of the website.

Although it has so many advantages, it also has some disadvantages, because it is realized through the filter principle. It is thought that another access will affect the point access speed, which can be ignored.

At present, urlrewriter technology has two technical platforms, one in the direction of Java and the other Net direction. Today we are talking about Java applications.

First, let's understand its working principle. To put it bluntly, it is a simple filter. Look at the source code and you will soon understand that it is implemented through two methods commonly used in jsp: forward(), sendredirect()

Let's quickly build URL rewriting technology for your website.

The above content comes from:

Here is an example of URL Rewriting:

preparation:

:urlrewrite-3.2. 0.jar

I downloaded:

1:

Input:

Input:

Not bad. Do you want to try it yourself

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>