且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-23 08:36:15

如果你想捕捉的查询字符串的一部分,你必须使用的 的RewriteCond QUERY_STRING

If you want to capture part of the query string, you must use a RewriteCond with QUERY_STRING

RewriteEngine On
RewriteCond %{QUERY_STRING} p=(.+)
RewriteRule ^/?index.php$ /%1? [R,L]

这会将客户端重定向到新的URL http://www.domain.net/beer

This redirects the client to the new URL http://www.domain.net/beer.