生成动态网页的URL

I recently was asked to look into a possibility of generating a url that would lead to a dynamic page.

Here is my use case: A client comes onto a page like http://www.example.com/customvideo here they enter a predefined form with things like company name, adress and upload a image of their logo.

After that they click on the button "make video" (or whatever) and a url is generated that leads to a page where their info is inputted in a page with some css animations.

So I had in mind that all their info will be uploaded to the server in a folder with a generated random number like "10010" and in here all their information from the form will be uploaded in a single info.json file and their logo is resized and uploaded as logo.jpg to that same folder.

The url generated will then be like http://www.example.com/customvideo/10010 The url sees the "10010" part, looks up the folder, gets the json file. Inputs the data in the fields I specify on the page and grabs the logo.jpg and places it on the page which then animates CSS.

Is this a doable scenario?

Is something like this even possible?

Yes - it's a common scenario, called "URL rewriting". It typically requires you to have access to your web service config (e.g. Apache, NGINX), or to add entries to .htaccess (not all hosts allow this) but it's pretty straightforward.

You create a rewrite rule that says "every time someone requests http://www.example.com//customvideo/parameter, map that to http://www.example.com/customvideo/handler.php?client=parameter".

In Apache, that would be:

RewriteRule    ^customvideo/([0-9]+)/?$    handler.php?client=$1    [NC,L]    # Handle video requests

Create an .htaccess in your file root and stick a line that looks like this in there

 RewriteEngine on
 RewriteRule ^customvideo?/?([A-Za-z0-9-]+)?/?$ /VideoDisplayer/?VideoID=$1 [NC]

This makes it so that when a user types in customvideo/12345

the server actually brings up the page videoDisplayer/index.php?VideoID=12345

From there, you will be able to user $_GET["VideoID"] to access the data 12345 and use it to pick the right video.

NOTE:

If its not working, make sure in your server settings you allow .htaccess to apply