문제

Currently i have the following rewrite:

RewriteRule ([^/]*)/order/([^/]*)[/]? /order_form.php?lang=$1&plan=$2 [QSA,L]

which translates into: /en/order/ OR /en/order/plan1/

Which works fine. However, i'd like to add something on the back. Something like plan1-companyname.

But i can't seem to get it working.

i tried:

RewriteRule ([^/]*)/order/([^/]*)-companyname[/]? /order_form.php?lang=$1&plan=$2 [QSA,L]

but this makes it mandatory. when i include brackets

RewriteRule ([^/]*)/order/([^/]*)[-bucket/]? /order_form.php?lang=$1&plan=$2 [QSA,L]

it doesnt work either. Can someone fix me up or kickstart me?

도움이 되었습니까?

해결책

You want to use parentheses instead of square brackets:

RewriteRule ([^/]*)/order/([^/]*?)(-companyname)?/?$ /order_form.php?lang=$1&plan=$2 [QSA,L]

Additionally, you need to make your second ([^/]*) grouping non-greedy.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top