I searched and tried nearly two weeks but don't get any useful result, so I'm trying my luck here before I get crazy:

Every existing domain should get an unique ID right after the domain. The ID should be 8 digits and contains a random value a-z,A-Z,0-9 which changes automatically every 24 hours.

For example:

http://domain.com/subdomain/page.html          <-- Original URL
http://domain.com/W7zjcTP5/subdomain/page.html <-- Changed URL
http://domain.com/jfP7x9sZ/subdomain/page.html <-- 1 day later
http://domain.com/eh7PjCzG/subdomain/page.html <-- 2 days later
http://domain.com/JF8scd4d/subdomain/page.html <-- 3 days later

But when someone saved the link 5 days ago, this link should still be usable and accessable, so thereforce there must be saved the actual active ID and all used IDs for each URL somewhere, to redirecting to original URL. Also when one ID was used before, it must not used never again. When using a generated ID there also have to be a check if this ID was created before.

I really get stuck and don't know how to solve this problem, thank you for your help!

  • Why would you want to do this? What happens if somebody visits a URL that has never been used before? Would it be a problem if all 8 character codes redirected? – Stephen Ostermiller Feb 23 '17 at 11:12
  • When someone visits a URL that never been used before, then it will happen that what happens on every websites when you try to enter an URL that doesn't exist -> you will get an error 404. – Nintendo64 Feb 23 '17 at 11:54
  • So what is the purpose of this? – Stephen Ostermiller Feb 23 '17 at 12:24
  • Are old links only accessible if they have previously been requested? Or do they simply remain accessible when they are created? Otherwise, why generate new IDs (for reporting purposes)? Is there intended to be a method of authentication? If so, how? What stops someone accessing the "original URL" directly? "...redirecting to original URL" - external redirect or internal rewrite (I think you may mean the later)? – MrWhite Feb 23 '17 at 15:19