我有一个使用 PHP 表单中的 GET 变量生成的 URL。我遇到的问题是传递了两个变量。这是一个用于澄清的示例 URL:
http://www.examplesite.com/example.php?first=one&second=two
我想在我的 .htaccess 中使用 mod_rewrite 来使这个 URL 更小。理想情况下,我想要 URL...
http://www.examplesite.com/one
能够重定向到完整的 URL...
http://www.examplesite.com/example.php?first=one&second=two
但正如你所看到的,有两个变量。这可能吗?如果不是,我可以使用这两个变量获取 URL 的最短时间是多少?
这是我目前用 mod_rewrite 解决这个问题的尝试
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