regex - .htaccess dash separator 2 params or more -
i'm working .htaccess, , want make friendly urls.
my current url:
www.url.com/index.php?v=[something]&i=[idiom] but can be:
www.url.com/index.php?v=[something] what want:
www.url.com/[something]-[idiom] or in second case:
www.url.com/[something] .htaccess config made:
rewriterule ^([^/]+)-([^/]+)?$ index.php?v=$1&i=$2 writing www.url.com/[something]-[idiom] goes okay, webpage running properly. in second case have write www.url.com/[something]**-**. if write www.url.com/[something] page breaks.
so, want make second param optional, , separated dash if it's possible.
can 1 me please?
it won't match www.url.com/[something] because expects - @ end. include - inside second capturing group, so:
^([^/]+?)(-[^/]+)?$
also changed first greedy quantifier lazy 1 avoid matching much.
Comments
Post a Comment