Url shortening design issue |
[eluser]codex[/eluser]
I too want to offer short urls, which means the first segment of the url should be reserved for the shortened url. But the way I have designed my app is that the first segment is the username. Dillemma! I basically have 2 options: 1) make the username the 2nd segment, and the 1st an 'identifier' (http://domain.com/photos/username instead of http://domain.com/username/photos). This way you can have the 1st seg free for the short url. 2) add something to the short url, maybe http://domain.com/~bw7jsd, or http://domain.com/p/bw7jsd. If the first part (~ or p/) is found, it's a short url. Redirect! What would you do?
[eluser]Enorog[/eluser]
The first idea looks much better (http://domain.com/username/photos). I have something similar right now, this is how to set up the routes file: Code: $route[':any'] = "username"; // drive all the pages to username controller Inside the username controller, just grab the url from index function like this: Code: class Username extends Controller { |
Welcome Guest, Not a member yet? Register Sign In |