【发布时间】:2014-06-20 17:01:44
【问题描述】:
我正在尝试使用的网站是http://northidahocvma.org/2GD/index.php?page=1
所以假设我的 URL 带有如下查询字符串参数:
/index.php?page=1
使用 mod_rewrite,我如何将它们重定向到这样的 URL?
/page/1 或 /1/
我得到了这个代码,但仍然无法弄清楚
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+index\.php\?page=([^\s&]+) [NC]
RewriteRule ^ /page/%1? [R=302,L]
RewriteRule ^page/([^/.]+)/?$ /index.php?page=$1 [L,QSA,NC]
【问题讨论】:
标签: .htaccess mod-rewrite query-string