Creating links but avoiding creating a folder on the server for each link

I want to allow auto generation of links such as to bring up specific information about when shared with other people.

I’ve previously implemented a script that auto generated a link such as

I achieved this using the mkdir and copy commands in PHP. The created folder; ‘link_reference’ contained only index.php which obtained the ‘link_reference’ value out of the browser address variable in javascript and used it to display various information pertaining to the ‘link_reference.’

I’m wondering if there is a better way of achieving this, without creating a new folder each time. I’m using the Google App Engine, and so I’m thinking that the app.yaml file might be useful for this.

The YAML is:

application: my_app****
version: 1
module: default
runtime: php55
api_version: 1

# Serve images as static resources.
- url: /(.+.(gif|png|jpg))$
  upload: .+.(gif|png|jpg)$
  application_readable: true

- url: /javascript
  static_dir: javascript
  mime_type: text/html
  application_readable: true

# Serve php scripts.
- url: /(.+.php)$

# Go to index.php when domain entered
- url: /
  script: index.php

# Go to get_reference.php when link_reference detected
- url: /***some kind of matching expression
  script: get_reference.php

Presently, the auto generated reference is 8 characters, uppercase letters or integers only. E.g.: GLS8L4RS

I’m not sure how to set up a regex matching expression, and I’m not sure if this is even the best practice implementation of a solution.

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.