I was browsing the internet and noticed, YouTube, for example, contains a URL like this to denote a video page: http://www.youtube.com/watch?v=gwS1tGLB0vc
.
The normal behavior of a web server is to map the requested URI path onto a file somewhere in the document root directory. So http://example.com/foo/bar
is simply mapped onto /path/do/document/root/foo/bar
. Additionally, the web server needs to know how to handle a file. This is often done by the file name extension. So files with the file name extension .php
are handled by the PHP interpreter.
Now apart from this normal behavior, most web servers have features that allow to change both the mapping (i.e. URL rewriting) and the way how a file without a file name extension is handled.
In case of the Apache web server, the former can be done with mod_rewrite:
RewriteEngine on
RewriteRule ^/watch$ /watch.php
And the latter can be done with mod_mime:
<File watch>
ForceType application/x-httpd-php
</File>
(Ok, actually this is not mod_mime feature but a core feature.)