Rewrite url's

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Rewrite url's

Post by klevis miho »

How do I rewrite this url:
domain.com/bands/band-name/album-name/

to:
domain.com/bands.php?bname=band-name&aname=album-name?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Rewrite url's

Post by VladSun »

Maybe:
[text]RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /bands/(.+)/(.+)/ /bands.php?bname=$1&aname=$2[L][/text]
There are 10 types of people in this world, those who understand binary and those who don't
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Rewrite url's

Post by klevis miho »

what if i then want to rewrite just /bands/?
Post Reply