使用 .htaccess 重写 GET 查询字符串

Rewrite GET Query String using .htaccess

我想Rewrite我的GET Query String从此-

http://www.example.com/verify.php?key=547b52f2b5d20d258e62de1e27b55c

至此

http://www.example.com/verify/547b52f2b5d20d258e62de1e27b55c

我正在使用以下规则,但它似乎不起作用 -

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(([A-Za-z0-9\-]+/)*[A-Za-z0-9\-]+)?$ .php

RewriteRule    ^[A-Za-z-]+/([A-Za-z0-9-]+)/?$    verify.php?key=    [NC,L]

使用以下内容:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /verify\.php\?key=([^\s&]+) [NC]
RewriteRule ^verify\.php$ /verify/%1? [R=301,L]

RewriteRule ^verify/([^/]+)/?$ /verify.php?key= [NC,L]