htaccess mod_rewrite help

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
turulojko
Forum Newbie
Posts: 6
Joined: Fri Feb 22, 2008 6:45 am

htaccess mod_rewrite help

Post by turulojko »

hi,
i need some help with .htaccess

i want urls like:
http://www.bla.com/gallery.php?what=dis ... 2007&pic=3

to be shown like:
http://www.bla.com/gallery/disco/kiss/12112007/3/

i use
RewriteRule ^gallery/(.*)/ gallery.php?what=$1
RewriteRule ^gallery/(.*)/(.*)/ gallery.php?what=$1&place=$2
...

but this only works when your url is http://www.bla.com/gallery/disco/
when your url is http://www.bla.com/gallery/disco/kiss/ (...) doesn't work.

so, can someone help me somehow?
thanks!
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Re: htaccess mod_rewrite help

Post by Rovas »

Probably there is a problem in the php code. Take notice that you need you implement a function \ class that translates the new url string so PHP knows what' s going on.
Try this new rule:

Code: Select all

RewriteRule ^gallery/(([0-9] *)/([0-9] *) gallery.php?what=$1&place=$2
Post Reply