regex - htaccess - combine rewrites into single -
i have couple of rewriterules i'd combine one. i'm not sure how it, though. think arounds need used? difference between 2 first match like:
search/foo
or search/foo/
and second match
search/foo/10
or search/foo/10/
rewrites:
rewriterule ^search/([a-za-z]+)/?$ index.php?page=search&query=$1&pn=1 [l] rewriterule ^search/([a-za-z]+)/([0-9]+)/?$ index.php?page=search&query=$1&pn=$2 [l]
without using arounds, attempt
^search/([a-za-z]+)/?([0-9]+)?/?$
but think match undesirable this?
search/foo10
edit:
i'm tryin regex match following uris:
search/foo
search/foo/
search/foo/1
search/foo/1/
^search/([a-za-z]+)(/)?([0-9]+)?\/?$
will work? might have make '/' match pattern , ignore $2.same can followed trailing '/' , ignore $4.
Comments
Post a Comment