【发布时间】:2014-06-03 22:56:39
【问题描述】:
所以我的框架可以通过一个 index.php 页面处理所有 URL。如果我放 site.com/profile/user 它将转到 site.com/index.php?url=profile&next=user 并且参数“url”加载不同的页面,例如 /home 将是索引。 php?url=home
现在的问题是我不会在 htaccess 文件中扩展我的重写规则,所以我还有一个额外的参数,例如 site.com/profile/user/auctions,它看起来像 site.com/index.php ?url=profile&next=user&category=auctions.
我的重写规则如下:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^]+)/([^/]+)(/([^/]+))?$ index.php?url=$1&next=$2
所以问题是我不能添加额外的“类别”参数,即 index.php?url=$1&next=$2&category=$3 ,每当我更改规则时,一个参数有效,但其他参数无效。
感谢您的阅读,希望可以解决。
【问题讨论】:
-
也许这个答案有帮助:stackoverflow.com/a/19309893/727208
标签: php .htaccess mod-rewrite