Forum Moderators: phranque
Ive this in .htaaccess
RewriteRule ^mob/([a-zA-Z-]+)-opinions-([0-9-]+)-([0-9-]+)-([0-9-]+)$ mob/allopinions.php?phone=$1&c=$2&limit=$3&page=$4
so it should return something like
nokia-opinions-1-12-2
and it returns it fine
but when i get the value of
$c, $limit, $page
which should be
$c = 1
$limit = 12
$page = 2
it returns
$c = 1-12-2
and the other 2 are empty
so how is that?
Thanks in advance
This ([0-9-]+) matches any number from 0 to 9 OR - 1 or more times, so, it matches the entire string you are trying to match with this ([0-9-]+)-([0-9-]+)-([0-9-]+) IOW all the numbers are being stored in the first variable.
The correction would be ([0-9]+)-([0-9]+)-([0-9]+)
Hope this helps.
Justin
so now i want this to work, It gives
"HTTP 404 not found"
This is the rule:
RewriteRule ^([a-zA-Z-]+)-([0-9-]+)-([0-9-]+)-([0-9-]+)-opinions$ allopinions.php?phone=$1&c=$2&limit=$3&page=$4
This is the link:
[mysite.com...]
am really getting crazy.. I cant find where is the mistake!
the allopinions.php is there and the link works when i write it like this:
[mysite.com...]
PLease help! thanks in advance
I cannot see your whole file, so I do not know what other conflicts, or catches there may be in the rules/conditions/regular expressions, but the correction for the regular expression I posted earlier is correct.
The forum charter is right above the Apache Web Server title on this page, here is a link:
[webmasterworld.com...]
You can also find more information here: (See page 2 message #13)
[webmasterworld.com...]
Wish I could tell you something different, but ([0-9-]+) matches and stores 1 or more of '0 to 9 or -' until there is a character in the string that does not match, a break in the line (EG space) or the line ends.
Justin