2017-08-21 111 views
0

所以目前我已经得到了URL websitename.com/posts/postweb.config中:URL重写以删除目录

,我想将其更改为websitename.com/post

我一直在努力,现在3天,没有运气。见过的.htaccess的东西负载,但没有多少的web.config提前

道歉,因为我敢肯定,我问一个非常愚蠢的问题,

谢谢!

回答

0

也许这就是你想要的。把它放在你网站的根目录下。您也可以在那里将Rewrite更改为Redirect

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="posts" patternSyntax="ExactMatch"> 
        <match url="/posts/post" /> 
        <action type="Rewrite" url="/post" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration>