Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache URL重写-删除字符串_Apache_.htaccess_Iis_Mod Rewrite_Url Rewriting - Fatal编程技术网

Apache URL重写-删除字符串

Apache URL重写-删除字符串,apache,.htaccess,iis,mod-rewrite,url-rewriting,Apache,.htaccess,Iis,Mod Rewrite,Url Rewriting,我需要重写由我的CMS处理的URL。基本上,当它看到: www.mydomain.com/du/section/title 它需要重写URL和进程: www.mydomain.com/section/title 我尝试了模式(.*)(/du/)(.*),然后将重写URL设置为{R:1}/{R:3},其中{R:1}是/du/之前的所有内容,{R:3}是之后的所有内容,但我没有任何运气 任何建议都将不胜感激,不必为IIS编写,可以是Apache mod_重写,我可以导入它 以下是我的web.conf

我需要重写由我的CMS处理的URL。基本上,当它看到:

www.mydomain.com/du/section/title

它需要重写URL和进程:

www.mydomain.com/section/title

我尝试了模式
(.*)(/du/)(.*)
,然后将重写URL设置为{R:1}/{R:3},其中{R:1}是/du/之前的所有内容,{R:3}是之后的所有内容,但我没有任何运气

任何建议都将不胜感激,不必为IIS编写,可以是Apache mod_重写,我可以导入它

以下是我的web.config文件中的重写规则:

`<rule name="DU Rewrite" patternSyntax="ECMAScript">
     <match url="([^/]*/)(du/)(.*)" />
     <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
     <action type="Rewrite" url="{R:1}{R:3}" appendQueryString="true" />
 </rule>`
`
`

谢谢

您想要的正则表达式是
([^/]*/)(du/)(.*)
,它仍然在URL中保留/du/,并且不会处理正确的正则表达式。它确实正确地测试并将URL的必要部分分组到正确的组中,但不会重写它。那么,您的问题就出在您的配置中,您还没有发布配置。