Parsing Mod-Rewrite
I'm trying to get two parameters with mod-rewrite开发者_开发技巧. I tried to split them with "-" but unfortunately it returns last word as second parameter.
/ders/ilkogretim-matematik
/ders/ilkogretim-fen-ve-teknolojishould be the URLs, "ilkogretim" will be the first parameter and the rest of it will be the second parameter. (After first "-")
My rules as follows:
RewriteRule ^ders/(.*)-(.*)/?$ /ogretmenler.php?sinif=$1&ders=$2 [QSA,L]
I hope I could explain the problem..
Thanks in advance...
Your .
is only capturing a single character - you need a quantifier on there.
I've also made the first group capture any character except -
:
ders/([^-]+)-(.*)/?$ /ogretmenler.php?sinif=$1&ders=$2 [QSA,L]
The problem is the single dots (.)-(.)
will only match a single character. You probably want something like
^/ders/([^-]*)-(.*)/?$
The first group will match zero or more non -
characters, followed by the single -
and then the 2nd group will match zero or more of any character (you could restrict this more if desired).
精彩评论