| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| DNOA Member | Hi, I am making a short URL service (ZSR.us). How do I do it? lol Thanks, -Matt
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #2 (permalink) |
| Account Closed | Ok, heres an idea ,if you want to have it be like USER.zsr.us then you need to set up wildcard subdomains (Wild Card DNS i think its called) in Apache. Then you need to set up URL rewriting in the .htaccess file. And then foward USER.zsr.us to like zsr.us/url.php?id=USER. Then on url.php You need to query your db of the user's actual URL, then header foward to that URL. |
| |
| | #3 (permalink) |
| Senior Member | All you need to do is get the URL the person wants a short link for, input that into the database along with a random unique string (you could use the id number that you would use in your database for the url but that could possibly start getting big, with unique random strings they at least can be used again when the old link is redundant and deleted) Of course return the link to the person so they know what it is. when someone clicks the link (which would obviously have a variable in it) you need to select the URL from the database (obviously after checking the variable has not been tampered with) and do a header redirect to the url you have just received from the DB.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #4 (permalink) |
| DNOA Member | Thanks for the ideas! Suppose I just want it to be accessable like zsr.us/idnumber or, zsr.us/sitename How can I do THAT? What is URL rewriting with the .htaccess file?
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #5 (permalink) | ||
| Senior Member | Quote:
Quote:
if you want it just to be like zsr.us/idnumber as if it was another folder on your site then you will need to do some trickery such as a custom 404 page so when it fails it sees if the folder nane is ina format you would expect it to be in then use header redirect then if not then just throw a 404 page as ussual.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft | ||
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| soooo many yahoo's | redhippo | Domain Name Discussion | 5 | 07-12-2005 11:26 PM |
| Want to start your own short url service? | axilant | For Sale / Advertising Board | 0 | 05-03-2005 04:02 PM |
| free subdomain/ short url redirect | geekpipe | Free Resources | 4 | 07-16-2004 04:56 PM |