0

网址:http://example.com/good_game/osmp/

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /?service=$1&terminal=$2 [L,QSA]

我收到

Array ( [service] => good_game [terminal] => osmp )

没关系,但是

网址:http://example.com/good_gamehttp://example.com/good_game/

我需要

Array ( [service] => good_game)

它返回 404 not found

4

1 回答 1

1

这应该适用于两者:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*|)/?([^/]*|)/?$ /?service=$1&terminal=$2 [L,QSA]

将匹配:

http://example.com/good_game/osmp/
http://example.com/good_game/osmp
http://example.com/good_game/
http://example.com/good_game
于 2013-08-28T08:17:30.567 回答