1

I'm having a annoying issue with rewrite-using cherokee web-server.

I want to convert:

http://example.com/mypage.phtml?cmd=print
=> to =>
http://example.com/index.php?page=mypage&cmd=print

The problem is that the ?-sign messes up the cmd;

$_GET : array('page'=>'mypage', '?cmd'=>'print')

Cherokee is configured with:

regexp: ^/(.*)\.phtml(.*)$
internal subst: /index.php?page=$1&$2

So my question: How to best "eat up" the question-mark if present.

Regards,

//teson

Teson
  • 6,644
  • 8
  • 46
  • 69

1 Answers1

5

Try matching it explicitly before the capturing parentheses:

regexp: ^/(.*)\.phtml\??(.*)$

\? is a literal ?, and the following ? means "match 0 or 1 times".

Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561