I’m dealing with a web-service that serves video files (host). They provide you with a Guid which is used in an embed code (link to js file).
Their URL’s are structured like this:
http://www.foo.com/34534525lsjda345435/script.js
Somehow, the script.js parses this URL and retrieves the variable. Can someone clue me in how this is done?
What kind of script runs on the server-side to respond to these requests? After all, the string in the URL doesn’t really refer to a real directory, or does it?
Any help/insights would be appreciated.
They most likely rewrite the URL and pass that ID to a script which generates the Javascript — by generate I mean embed any video-specific data into the javascript. A javascript file doesn’t have knowledge of the URL where it resides, only the URL of the window or frame where it’s being loaded.
Where
foo.com/gen_script?id=$1is the script that actually generates that file.If they use something like mod_rewrite, you would find something like the following in their config file: