A rewrite engine is a component of web server software that allows you to rewrite or redirect uniform resource locators (URLs). The most popular rewrite engine is the Apache HTTP server’s mod_rewrite. There are other web servers, such as nginx or lighttpd, that provide similar functions.
Some content management systems generate cumbersome URLs. This software component is used to convert them into user-friendly URLs. The reasons for this are obvious: technical URLs such as
"http://example.com/a/index.php?title=pagetitle"
aren’t easy to remember; a rewrite engine enables the URL to be written in a much more intuitive way:
"http://example.com/article/pagetitle"
An internet user can also use this URL to access a corresponding web page. If a request like this is received by the web server, the rewrite engine automatically converts the URL into the internal one used by the server
"http://example.com/a/index.php?title=pagetitle"
The rewrite engine creates an abstraction layer between the URLs used internally by the web project and the URLs publically displayed online. This makes it possible to provide a user-friendly, consistent address scheme, regardless of internal technical requirements.
Internally, the dynamic, parameterized address can continue to be used while users from the internet access the web project via a seemingly static address. This function has the advantage that externally-presented URLs remain valid even if internal changes are made to the file hierarchy.
In addition, website operators can use the rewrite engine to implement address redirects, which can be linked to specific conditions. In effect, it is possible to set up redirects based on the user agent string or the IP address of the requesting client, in order to implement geo targeting or to have targeted, optimized websites appear on different devices. A 301 redirect is generally used, which ensures that only one version of the website is stored in the search engine’s index, despite the parallel operation of additional mobile websites or different language versions.
Website operators should make sure they stay away from cloaking practices, which is where optimized sites are specifically created and shown to search engine crawlers in order to improve rankings.