Reputation: 369
URL: http://example.com/good_game/osmp/
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)(.*)$ /?service=$1&terminal=$2 [L,QSA]
i receive
Array ( [service] => good_game [terminal] => /osmp/ )
i need
Array ( [service] => good_game [terminal] => osmp )
and what RewriteRule i need for multiparams?
Upvotes: 0
Views: 38
Reputation: 56
A RewriteRule like:
RewriteRule ^/([^/]*)/([^/]*)/?$ /?service=$1&terminal=$2 [L,QSA]
Should do what you need. Basically, put the characters you don't want in your parameters outside the () to avoid capturing them.
Upvotes: 1
Reputation: 19528
This should give u what you want:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /?service=$1&terminal=$2 [L,QSA]
Your problem with your rule is that you're using (.*)
after your first group so it will get anything left by that group which is /anything/
.
So basically your rule is telling the server to get anything not a /
so it gets good_game, then you're asking it to get anything left so it gets /osmp/
.
Upvotes: 1