0
RewriteEngine on
RewriteRule ^([A-Za-z0-9-_]+)$ index.php?paste=$1 [L] 

正如您在上面看到的那样,它需要site.com/index.php?paste=pasteID并将其变成site.com/pasteID

现在我想知道一种可以像这样编辑粘贴的方法。

site.com/index.php?paste=pasteID&page=edit
site.com/pasteID/edit

无论如何我可以做到这一点吗?

4

1 回答 1

0
RewriteEngine on
RewriteRule ^([A-Za-z0-9-_]+)$ index.php?paste=$1 [L]
RewriteRule ^([A-Za-z0-9-_]+)/edit$ index.php?paste=$1&page=edit [L]

例子:

  • domain.com/534->index.php?paste=534
  • domain.com/abc->index.php?paste=abc
  • domain.com/abc123->index.php?paste=abc123
  • domain.com/534/edit->index.php?paste=534&page=edit
  • domain.com/abc/edit->index.php?paste=abc&page=edit
  • domain.com/abc123/edit->index.php?paste=abc123&page=edit
于 2013-02-23T11:33:40.637 回答