Php 需要澄清mod_重写问题

Php 需要澄清mod_重写问题,php,apache,url,mod-rewrite,short,Php,Apache,Url,Mod Rewrite,Short,我有一个URL,它是使用PHP中表单的GET变量生成的。我遇到的问题是有两个变量被传递。下面是一个示例URL以澄清: http://www.examplesite.com/example.php?first=one&second=two 我想在我的.htaccess中使用mod_重写,使其成为一个较小的URL。理想情况下,我想的网址 http://www.examplesite.com/one 要能够重定向到完整的URL http://www.examplesite.com/exam

我有一个URL,它是使用PHP中表单的GET变量生成的。我遇到的问题是有两个变量被传递。下面是一个示例URL以澄清:

http://www.examplesite.com/example.php?first=one&second=two
我想在我的.htaccess中使用mod_重写,使其成为一个较小的URL。理想情况下,我想的网址

http://www.examplesite.com/one
要能够重定向到完整的URL

http://www.examplesite.com/example.php?first=one&second=two
但正如你所看到的,有两个变量。这可能吗?如果不是,那么使用这两个变量可以获得URL的最短路径是什么

这是我目前试图用mod_重写来解决这个问题的尝试

RewriteEngine on  

# don't rewrite if the file exists
RewriteCond %{REQUEST_FILENAME} !-f
# don't rewrite if the directory exists
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ example.php?first=$1&second=$2
试试这个:

RewriteEngine on  

# don't rewrite if the file exists
RewriteCond %{REQUEST_FILENAME} !-f
# don't rewrite if the directory exists
RewriteCond %{REQUEST_FILENAME} !-d

# http://www.examplesite.com/one/two
RewriteRule ^([^/]*)/([^/]*)$ /example.php?first=$1&second=$2 [L]