0

URL: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 )

大丈夫ですが、

URL:http://example.com/good_gameまたは http://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 に答える