Rewrite engine


Free Web Hosting with Website Builder

A rewrite engine is software which modifies a web URL's appearance (URL rewriting). Users of web applications prefer short, neat URLs to raw query string parameters. A concise URL is easy to remember, and less time-consuming to type in. If the URL can be made to relate clearly to the content of the page, then errors are less likely to happen.

Search engine friendly URLs (for short SEF URLs) are implemented with Rewrite engines.

URL rewriting is not URL redirection.

Contents

Examples

This URL contains query string parameters to encode the date for which some blog engines should show available postings

http://www.somebloghost.com/Blogs/Posts.php?Year=2006&Month=12&Day=10

but can be altered to give the user a clear idea of what he or she is going to see

http://www.somebloghost.com/Blogs/2006/12/10/

The second address also allows the user to change the URL to see all postings available in December, simply by removing the text encoding the day '10', and thereby saving having to navigate the GUI.

http://www.somehost.com/Blogs/2006/12/.

Another example might be changing

http://example.com/wiki/index.php?title=Page_title

to...

http://example.com/Page_title

The benefits of a rewrite engine are[1]:

  • Making website URLs more user and search engine friendly
  • Preventing undesired "inline linking"
  • Not exposing the inner workings of a web site's address to visitors
  • The URLs of pages on the web site can be kept even if the underlying technology used to serve them is changed

Known drawbacks:

  • In some cases, for example if user modifies URL to get specified data the rewrite engine may hinder from querying. See below example:
Which is a month and which is a day?
http://www.somebloghost.com/Blogs/2006/12/10/
The query like that is more useful than:
http://www.somebloghost.com/Blogs/Posts.php?Year=2006&Month=12&Day=10

Java

In Java, the term "URL rewriting" sometimes describes a Web Application Server adding a session id to a URL when cookies are not supported (e.g. "index.jsp" is rewritten to "index.jsp;jsessionid=xyc" when the links are drawn in an HTML page).

Modern web frameworks

Recent generations of web frameworks usually include URL rewriting: Ruby on Rails has built-in URL rewriting via Routes[2], Django uses a regular-expressions based system[3], Java's Stripes Framework used to require a third-party extension[4] but integrated the module in the core distribution with Stripes 1.5[5]

See also

Notes

  1. ^ Many of these only apply to HTTP servers whose default behavior is to map URLs to filesystem entities (i.e. files and directories); certain environments, such as many HTTP application server platforms, make this irrelevant.
  2. ^ Routes
  3. ^ Django URLconf
  4. ^ Stripes' "Clean Urls" extension
  5. ^ clean urls in Stripes 1.5

External links

Apache

IIS

Rewrite engines

Apache Software Foundation's Apache HTTP server

  • mod_rewrite Apache module described as "the Swiss Army knife of URL manipulation".[citation needed]
  • mod_alias Simpler Apache module allow for manipulation and control of URLs as requests arrive at the server..

Microsoft's Internet Information Server (IIS)

Java 2 Platform, Enterprise Edition (J2EE) Servlet container servers (such as Apache Tomcat, Resin, Orion etc):







Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History