Forum Moderators: phranque

Message Too Old, No Replies

rewrite, tiny url and htaccess

rewrite

         

jgeek

9:20 pm on Jun 18, 2008 (gmt 0)

10+ Year Member



Hi,
I'm implementing an application similar to tinyurl.I'm a app developer and have limited experience with Apache. There are two redirect heuristics that I'm considering that are mentioned below. I need your advise on which one is a better option.

a) Having the application write the tiny url to .htaccess would obviously lead to 1000's of lines in the long term. Would this cause any performance issues ? I'm guessing this may not be a good option.

b) Redirect the short url as a query parameter for example: http://example.com/shorturlid must be converted and redirected by Apache to http://example.com/short.php?id=shorturlid so that the application can do the real redirect. If this is a better option what should be the redirect rule in Apache htaccess ? (to convert URL from http://example.com/shorturlid to the form http://example.com/short.php?id=shorturlid )

Any help in this matter is sincerely appreciated.

jgeek

9:43 pm on Jun 18, 2008 (gmt 0)

10+ Year Member



Alternately I have another idea that is working fine. The idea is :

Create a folder under the root domain (doc root)with the "shorturlid" named folder and create a .htaccess file with the following rule:

Options +FollowSymLinks
RewriteEngine on
redirectMatch permanent /shorturl/shorturlid [longurldestination.com...]

Is this is a good practice ? Would there be any performance issues ?