Rewrite engine

Rewrite engine

A rewrite engine is software that modifies a web URL's appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly - SEF) 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

Usage

Websites with dynamic content use URLs that generate pages from the server using query string parameters. These are often rewritten to resemble URLs for static pages on a site with a subdirectory hierarchy. For example, the URL to a wiki page might be:

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

but can be rewritten as:

http://example.com/wiki/Page_title

A blog might have a URL that encodes the dates of each entry:

http://www.example.com/Blog/Posts.php?Year=2006&Month=12&Day=19

It can be altered like this:

http://www.example.com/Blog/2006/12/19/

which also allows the user to change the URL to see all postings available in December, simply by removing the text encoding the day '19', as though navigating "up" a directory:

http://www.example.com/Blog/2006/12/

Benefits and drawbacks

There are several benefits to using a rewrite engine for URLs[1]:

There can, however be drawbacks as well; if a user wants to modify a URL to retrieve new data, the rewrite engine may hinder the construction of custom queries due to the lack of named variables. For example, it's difficult to determine the date from the following format:

http://www.example.com/Blog/12/10/2006/

In this case, the original query string was more useful, since the query variables indicated month and day:

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

Web frameworks

Many web frameworks include URL rewriting, either directly or through extension modules.

From a software development perspective, URL rewriting can aid in code modularization and control flow,[9] making it a useful feature of modern web frameworks.

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. ^ mod_rewrite documentation
  3. ^ URL Rewrite extension for Microsoft IIS
  4. ^ Routes
  5. ^ Django URLconf
  6. ^ clean urls in Stripes 1.5
  7. ^ [1]
  8. ^ [2]
  9. ^ DocForge: Clean URL

External links

Apache

  • Apache mod_rewrite
  • mod_alias Simpler Apache module allowing for manipulation and control of URLs as requests arrive at the server.
  • Rewrite rule tester This tool lets you write and test your rewrite rules for Apache's mod_rewrite on-the-fly.

Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Rewrite-Engine — Eine Rewrite Engine (von englisch rewrite, „umschreiben“ und engine, „Maschine“) ermöglicht es, an einen Webserver gerichtete Anfragen intern umzuschreiben oder extern weiterzuleiten. Die bedeutendste Rewrite Engine ist das Softwaremodul mod… …   Deutsch Wikipedia

  • Rewrite — may refer to one of the following: *Rewrite (programming), the act or result of writing new source code to replace an existing program *Rewrite man, a journalist who works in the office, taking information reported by others and crafting it into… …   Wikipedia

  • Mod rewrite — Eine Rewrite Engine (von engl. rewrite, „umschreiben“ und engine, „Maschine“) ermöglicht es, an den Webserver gerichtete Anfragen intern umzuschreiben oder extern weiterzuleiten. Die bedeutendste Rewrite Engine ist das Softwaremodul mod rewrite,… …   Deutsch Wikipedia

  • Web search engine — Search engine redirects here. For other uses, see Search engine (disambiguation). The three most widely used web search engines and their approximate share as of late 2010.[1] A web search engine is designed to search for information on the Wo …   Wikipedia

  • Search Engine (radio show) — Infobox Podcast title = Search Engine caption = Search Engine s Current Logo host = Jesse Brown url = http://cbc.ca/searchengine rss = http://www.cbc.ca/podcasting/includes/searchengine.xml format = Podcast, Radio genre = Technology Search Engine …   Wikipedia

  • Gecko (layout engine) — Gecko Developer(s) Mozilla Foundation / Mozilla Corporation Stable release 8.0 / November 8, 2011; 6 days ago (2011 11 08) [1] …   Wikipedia

  • Infinity Engine — Infobox Software name = Infinity Engine caption = The Mortuary room in which the game Planescape: Torment opens. developer = BioWare latest release version = latest release date = latest preview version = latest preview date = operating system =… …   Wikipedia

  • Clean URL — Clean URLs, RESTful URLs or user friendly URLs are purely structural URLs that do not contain a query string and instead contain only the path of the resource (after the scheme [e.g. http] and the authority [e.g. example.org]). This is often done …   Wikipedia

  • Apache HTTP Server — Original author(s) Robert McCool Developer(s) Apache Software Foundation Initial release …   Wikipedia

  • .htpasswd — htaccess (engl. hypertext access „Hypertext Zugriff“) ist eine Konfigurationsdatei, in der verzeichnisspezifische Einstellungen auf NCSA kompatiblen Webservern (z. B. Apache) vorgenommen werden können. Beispielsweise lässt sich dort ein… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”