Handeling http://site.com/xyz urls

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
sina_saeedi82
Forum Newbie
Posts: 11
Joined: Sun Aug 23, 2009 5:13 am

Handeling http://site.com/xyz urls

Post by sina_saeedi82 »

Hi, I'm a newbie PHP coder. Its a question for me to know, how sites like bit.ly and tinyurl.com handel this type of urls " http://site.com/xyz " ?
Are they make a folder named "xyz" and make a index file in it? If this, the count of folders gets huge! :lol:
How they handle this type of urls?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Handeling http://site.com/xyz urls

Post by jackpf »

No, I'm pretty sure they use url rewrites.

Google "apache mod_rewrite" and you'll see what I mean.

:)
sina_saeedi82
Forum Newbie
Posts: 11
Joined: Sun Aug 23, 2009 5:13 am

Re: Handeling http://site.com/xyz urls

Post by sina_saeedi82 »

I install mod_rewrite and google for .htaccess but i get confused! I'm newbie. Can you tell me how can I redirect http://site.com/xyz type urls to my own urls ?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Handeling http://site.com/xyz urls

Post by jackpf »

Code: Select all

RewriteRule ^xyz$ yourscript.php
Like that.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Handeling http://site.com/xyz urls

Post by JAB Creations »

Download WordPress and look at the .htaccess included.
User avatar
deejay
Forum Contributor
Posts: 201
Joined: Wed Jan 22, 2003 3:33 am
Location: Cornwall

Re: Handeling http://site.com/xyz urls

Post by deejay »

i found this tutorial on short urls when I need to set one up

http://www.ultramegatech.com/blog/2009/ ... url-clone/
sina_saeedi82
Forum Newbie
Posts: 11
Joined: Sun Aug 23, 2009 5:13 am

Re: Handeling http://site.com/xyz urls

Post by sina_saeedi82 »

Thank you all :)
Post Reply