How do you do short urls: www.domain.com/todayurl ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

How do you do short urls: www.domain.com/todayurl ?

Post by simonmlewis »

Hi

I am often seeing short urls, both in Facebook for usernames, and countless others.

I need to create short urls for a web site, much of the time it will need to be 'on the fly', to give a shorturl to a product.

ie. http://www.domain.co.uk/prod2218/
which may be for. index.php?page=product&id=2218&title=your product

Can anyone give a brilliant answer, as I don't see a simple method, and I am sure it'll be one of those answer that makes you go "ooohhh yeaahhh"....
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: How do you do short urls: www.domain.com/todayurl ?

Post by jackpf »

You'll be needing mod_rewrite for that (if you're using apache).

There are plenty of guides and tutorials on google. Just search apache mod_rewrite or something similar.
Post Reply