2017-05-26 64 views
0

我的.htaccess如下面,我需要example.com/updatetagsyncronize.html/1/2URL重写工作不正常

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

example.com/updatetagsyncronize.html - 它的工作原理是这样

,我需要

example.com/updatetagsyncronize.html/1/2 - 有两个额外的参数

我发现如何简化,并与这里simplified htaccess

多个参数使用,但它不工作

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

这是什么的意思([(*) - \ w] +)我怎么能重写这个,结合第一,因为我使用cms modx,也许这就是为什么我面临错误。 任何建议或链接。谢谢!!!

+1

http://www.rexegg.com/regex-quickstart.html – inarilo

回答

1

好吧,如果你通过检查文件的设置面板中删除相应的复选框,这里是你的字符串匹配的正则表达式让您的文档“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”

+0

它的工作原理,谢谢! –

+1

好。另外请确保其他页面也可以工作,并注意这个问题的答案:https://stackoverflow.com/questions/14786340/rewrite-url-with-htaccess-for-multiple-parameters您可能需要设置重写分别处理您的具体请求(.../1/2/part) – curveball

0

请大家看看CustomRequest额外的,如果你正在使用镆铘革命。在extras仓库中可用。