2

As I understand, web servers are able to map the path component of an URL either into local file system resource or web-application name. Example for former would be http://www.example.com/index.html. In this case, as I understand it, the web server would simply take the /home/www/index.html file and return it to requester. Example for web-applications would be http://www.example.com/get-page.php?home=aaa.html. Am I correct that get-page.php is the web-application name, i.e script file /home/www/get-page.php which is executed in server and aaa.html is a value for variable home used in this script?

2
  • Also note: there i not just php capable for creating dynamic content. So asking about dynamic content and refering to php is kinda incomplete. for example richhallstoke's answer while saying yes to you (probabbly in regard to php) is correct. My own server site dynamic fcgi app written in C, which is also targeted by the wording of you question my answer would strictly have to be: now you are completly wrong!
    – Zaibis
    Aug 21 '15 at 14:26
  • 1
    I had understood the PHP script was given solely as an example in the question and kept for consistency in my answer but yes @Zaibis is correct in that PHP is not the only server-side technology that can be used in creating dynamic content. Other popular alternatives might include .cgi, .asp, .aspx, .jsp, .pl, .cfm and there are many more. It is possible for a single website or web application to use a combination of these aswell depending on the web server configuration. Aug 25 '15 at 12:39
4

In short, yes you are correct. The only big part of the equation you are missing is server-side URL rewriting - where essentially a request for http://www.example.com/aaa could be internally redirected by the web server software to

http://www.example.com/get-page.php?home=aaa.html

as a method of having more user-friendly URL's or pretty URL's.

If your webserver software is Apache then this is achieved using .htaccess files and RewriteCond/RewriteRule.

See mod_rewrite documentation for more information about this.

6
  • I see, thanks! However, how to understand for example an URL 192.168.1.87/speed.htm?speeddial=1? I mean speed.htm is an HTML file in /home/www/ directory, but what it does with variable named speeddial? This URL is from actual VoIP phone which has built-in web-server.
    – Martin
    Aug 21 '15 at 11:39
  • 1
    In this instance: (a) It could be that some javascript is revealing information or requesting/submitting information via AJAX requests using this speeddial parameter; or Aug 21 '15 at 11:47
  • 2
    (b) It could be that speed.htm may not be a stored file as such - some embedded webservers behave more like a hardcoded question and answer setup rather than serving files from disk, for example a request handler may read the filename portion of the URL and just direct the request to an internal function such as Speed(1) and then send some headers/html back to the connection. Just because a device has an HTML interface doesn't mean the webserver implementation is standard/generic. Aug 21 '15 at 11:47
  • @richhallstoke: You mean HTTP interface, right? Aug 21 '15 at 14:27
  • Hmm no I did mean HTML interface as in for a webbrowser based user interface, but yes this would operate using HTTP protocol compatible requests similar to how websites work etc, but talking potentially to a non-standard or bespoke HTTP implementation which instead of serving or processing stored files/scripts it simply uses hardcoded event handler functions reading the requested path, query string and POST data as parameters. Aug 21 '15 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.