Page 1 of 1

How to shorten an URL in PHP?

Posted: Wed May 23, 2007 12:51 pm
by bambinou
Dear all,

i am having a very big problem at the moment,someone is designing my future website and told me that one of my request was impossible.

they have created a website where bands will open an account and have their own page.the problem is i need the band name to follow the site url.
ie:
if the site is called:
http://www.thisismysite.com



and a band called bhfffr open an account with us,i would like the band to put their band name is a requiered input field and then get a url specially for them like this one:
http://www.thisismysite.com/bhfffr

and not something like i am actually having:
http://www.thisismysite.com/store.php/bhfffr

is this possible in php?

the programmers i have hired told me this could cause a security problem because the file name would be seen by everyone.

the question is:
how can big sites like http://www.soundclick.com provide this kind of service???

how does all of this work,has anyone an idea please????


thank you very much ,


regards to all.



ben

Posted: Wed May 23, 2007 1:09 pm
by s.dot
You are looking for an apache rewrite rule.

Code: Select all

RewriteEngine On
RewriteRule ^([a-z0-9]{3,25}$ band_page.php?band=$1

Posted: Wed May 23, 2007 1:32 pm
by aaronhall
It is altogether possible as scottayy pointed out, and there aren't any security issues so long as sensitive data isn't exposed in the URL. Have your developer look up mod_rewrite.

Posted: Wed May 23, 2007 3:07 pm
by bambinou
Thank you very much my friends for your help,
would it be possible to be a bit more specific on how to do something like this,this way i can show this forum to our programmers.
thank you very much !!!!


regards,


ben

Posted: Wed May 23, 2007 4:09 pm
by RobertGonzalez
Tell your developer to come to this forum and search for mod_rewrite. That is all they need to know.