Rewrite engine
From Wikipedia, the free encyclopedia
A rewrite engine is software that modifies a web URL's appearance (URL rewriting). Rewritten URL's (sometimes known as short or fancy URL's) are used to provide shorter and more relevant-looking links to web pages. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.
Contents |
[edit] Examples
This URL contains query string parameters that encode blog entry dates
http://www.example.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.example.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.example.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 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.example.com/Blogs/2006/12/10/
- The query like that is more useful than:
- http://www.example.com/Blogs/Posts.php?Year=2006&Month=12&Day=10
- Which is a month and which is a day?
[edit] 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=xyz" when the links are drawn in an HTML page).
[edit] 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]
From a software development perspective, URL rewriting can aid in code modularization and control flow [6], making it a useful feature of modern web frameworks.
[edit] See also
- Permalink
- Apache HTTP Server
- Internet Information Server
- Zeus Web Server
- Content negotiation
- HTTP
- .htaccess
[edit] Notes
- ^ 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.
- ^ Routes
- ^ Django URLconf
- ^ Stripes' "Clean Urls" extension
- ^ clean urls in Stripes 1.5
- ^ DocForge: Clean URL
[edit] External links
This article's external links may not follow Wikipedia's content policies or guidelines. Please improve this article by removing excessive or inappropriate external links. |
[edit] Apache
- mod_rewrite, a beginner's guide (with examples): a guide to get you started using mod_rewrite.
- Apache mod rewrite tutorials and regular expression lessons: Mod rewrite instruction with Regular Expression syntax lessons, a how to tutorial from beginner to advanced
- Rewrite URLs with mod_rewrite: a tutorial for redirecting URLs.
- The Indie Publisher's mod_rewrite Recipe Book: a collection of mod_rewrite recipes especially for independent publishers.
- Quick introduction to mod_rewrite and when it is useful.
- Useful url rewriting examples 5 common and useful url rewriting examples.
- mod_rewrite Apache module described as "the Swiss Army knife of URL manipulation".
- Apache Rewrite Guide This document supplements the mod_rewrite reference documentation. It describes how one can use Apache's mod_rewrite to solve typical URL-based problems with which webmasters are commonly confronted.
- mod_alias Simpler Apache module allow for manipulation and control of URLs as requests arrive at the server.
[edit] IIS (Microsoft Internet Information Services)
- Bill Staples of Microsoft announces a new URL Rewrite Module for IIS7 which includes the ability to import Apache mod_rewrite rules
- How to redirect URLs to different Web sites Microsoft Knowledgebase article on built-in URL rewriting
- Scott Guthrie of Microsoft describes various techniques for URL rewriting in .NET
- A Complete URL Rewriting Solution for ASP.NET 2.0
- URL Rewrite Module for IIS 7.0 from Microsoft
- IIS Mod-Rewrite from Micronovae
- ISAPI_Rewrite from Helicon Tech
- URL Replacer from Motobit
- Ionic's ISAPI Rewrite Filter (IIRF) free and open source, written in C, requires no .NET, works with ASP.NET PHP Ruby JSP CFML etc; IIS5/6/7.
- .NET URL Rewriter and Reverse Proxy Free professional URL rewriting and reverse proxy package. Supports .NET 2.0, 3.5, IIS 6, IIS 7.
- VirtualUrl.NET Professional URL rewriting package.
- UrlRewriter.NET Free, open-source package. Supports .NET 1.1 and 2.0.
- URLRewriting.NET, free and open source supports, ASP.NET 2.0
- VirtualUrl.NET for ASP.NET 2 Professional URL rewriting package.
[edit] Zeus Web Server
- Converting Apache rules to ZWS
- Redirecting clients to Alternate Pages
- Zeus Web Server User Guide see page 140 "Configuring Request Rewrite Scripts" (PDF 3.58MB)
Note: Unlike Apache, entering rewrite rules in an .htaccess file will not work. They must be entered in Zeus' proprietary Request Rewrite scripting language through the zeus server's admin panel, which creates a rewrite.script file and installs it into the server. Unless you have access to the main server administration interface, you will need to ask your hosting provider to implement your rule.
[edit] Java Platform, Enterprise Edition (Java EE) Servlet container servers (Apache Tomcat, Resin, Orion etc)
- HttpRedirectFilter (open source)
- UrlRewriteFilter (open source - BSD) - allows you to rewrite URLs before they get to your code. Supports XML or mod_rewrite style config.