我正在使用以下.htaccess代码来获取漂亮的URL .

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/([\w-]+)/([\w-]+)$ app/post.php?&category=$2&slug=$3 [L,QSA]
RewriteRule ^(.+)/([\w-]+)$ app/post.php?category=$2 [L]

从上面的代码我可以实现以下目的:

从这个 https://www.example.com/post.php?category=tech&slug=some-title

https://www.example.com/tech/some-title

当我看到使用 print_r($_GET) 的参数作为URL https://www.example.com/tech/some-title

我能看到 Array ( [category] => tech [slug] => some-title )

但是当我传递这样的另一个论点时 https://www.example.com/tech/some-title/78yi

那我就看 Array ( [category] => some-title [slug] => 78yi )

等等,如果我继续添加它按照说明推送参数 .

如何使其保持一致 . 与参数无关 . 就像有人提出的参数一样,它应该只接受第一个和第二个参数 .