【发布时间】:2014-06-02 19:08:39
【问题描述】:
我的代码
www.test.com/index.php?A=1&B=123
我在 .htaccess 中使用此代码
RewriteRule ^(.*)/(.*).html index.php?A=$1&B=$2
输出:www.test.com/1/123.html
确定它在 2 个参数上工作
问题:有时我的网站有 1 个参数
www.test.com/index.php?A=1
我想输出这个:www.test.com/1.html
如何为 1 或 2 参数创建 RewriteRule ?
【问题讨论】:
标签: php regex apache .htaccess mod-rewrite