npinti helped me create a regex to remove the querystring and match the remaining segments from the url /seattle/restaurant/sushi?page=2: “Something like so should yield 3 groups: /(.*?)/(restaurant)/([^?]+).*. Group 1 being seatthe, group 2 being restaurant and group 3 being sushi. If after the last /there is a ?, the regex discards the ? and everything which follows.”
I have tried modifying the above to do the same trick on the url /seattle/restaurant?page=2 but I could not get it right. I don’t know if there will be af querystring or not or the parameters of the querystring. So I need the flexibility from the regex above which will match and discard the ? and everything which follows.
Your rewriterules may look like:
Your may search for what
QSA,NC, andLmean thanks to the links I provide below.I’m sorry but your question sound very like “I’m not very good, so can someone do the job for me?”. I mean, just look around, you’ll get a lot of answer, just get your hands dirty.
And if that’s not enough:
Two hints:
If you’re not in a hosted environment (= if it’s your own server and you can modify the virtual hosts, not only the
.htaccessfiles), try to use theRewriteLogdirective: it helps you to track down such problems:My favorite tool to check for regexp:
http://www.quanetic.com/Regex (don’t forget to choose ereg(POSIX) instead of preg(PCRE)!)