动态网址: http ://sample.com/articles.php?id=1&name=abc
静态网址: http ://sample.com/article/
我需要隐藏静态 URL 中的 ID 和名称。
我尝试在 htaccess 中使用以下代码
RewriteCond %{QUERY_STRING} ^id=(.*)&name=(.*)$
RewriteRule ^articles\.php$ /article/%1/%2? [R=301]
RewriteRule ^article/([^-]+)/([^-]+)$ /articles.php?article_id=$1&article_name=$2 [L]
但在代码中我必须使用 %1 和 %2 来获取 id 和 name。
有什么方法可以在没有的情况下获得这些值/%1/%2
先感谢您。