Apache HTTP Server, commonly known as Apache, is the most popular web server software that uses directives for its configuration which can be written into a .htaccess (hypertext access) hidden file, it's hidden for it is started with a "." dot. As directives are used to configure the most popular HTTP server, many other HTTP servers uses the same way to configure their systems too. One of the popular use of an HTTP server is to modifies a web Uniform Resource Locator's appearance which is called “URL Rewriting” and to redirect a web address to another URL, which called “URL Redirecting.” The abbreviation "HTTP" is stands for Hypertext Transfer Protocol. A web server that can modifies URL's appearance is often called as HTTP server instead of web server.
- URL Rewriting: Actually, the software that remapping the URL into another URL is called as rewrite engine which is basically runs on a web server. If the URL is rewriting into a different page, even you're viewing the page at that URL, you'll see the other page where it rewriting, even if it exist or not. Here's an example of .htaccess source' directives for configuring the
mod_rewrite
of Apache HTTP Server to rewrite:URL Example: .htaccess Directives' Sample: Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-zA-Z0-9_-]+)/?$ /page.php?file=$1 [NC,QSA]
Where Example's URLs are Remapping: - The no. 1 URL will be rewritten into http://www.example.com/page.php?file=index
- The no. 2 URL will be rewritten into http://www.example.com/page.php?file=test
- The no. 3 URL will be rewritten into http://www.example.com/page.php?file=anything