Url 重写无法正常工作

Url rewrite not working properly

我的.htaccess如下,我需要例子。com/updatetagsyncronize.html/1/2

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php?q= [L,QSA]

example.com/updatetagsyncronize.html - it works like this

我需要

example.com/updatetagsyncronize.html/1/2 - with two extra parameters

我在这里找到了如何简化和使用多个参数 simplified htaccess

但是没用

 RewriteRule ^([-\w]+)?/?([-\w]+)?/?([-\w]+)?/?$ index.php?q=&seg2=&seg3=

这个 (.*)([-\w]+) 是什么意思我怎么重写这个,首先结合,因为我正在使用 cms modx,也许这就是我遇到错误的原因。 任何建议或链接。谢谢!!!

好吧,如果您通过选中文档设置窗格中的相应复选框将文档 "updatetagsyncronize.html" 设为容器(仅 "updatetagsyncronize"),则这里是与您的字符串相匹配的正则表达式:

^([-\w\.]+)?\/?([-\w]+)?\/?([-\w]+)?\/?([-\w]+)?\/?$
// example.com/updatetagsyncronize/1/2/ or example.com/updatetagsyncronize/1/2

您还需要在 modx 系统设置中启用友好的 URL。或者

^([-\w\.]+)?\/?([-\w\.]+)?\/?([-\w]+)?\/?([-\w]+)?\/?$

如果您坚持使用“.html”

如果您使用的是 MODX Revolution,请查看额外的 CustomRequest。在 extras 存储库中可用。