2016-01-21 79 views
4

我在wordpress根文件夹中有静态php页面。在web.config文件中,我将默认文件更改为静态PHP文件home.php。我有几个静态PHP页面和几个WordPress网页。 WordPress的页面改变使用固定链接,但静态PHP页面无法删除.PHP extenstions如何从web.config文件从wordpress根文件夹中删除.php扩展

搜索引擎友好的URL

如:http://reactore.com/contact-us/ --- WordPress的页面 http://reactore.com/about-us.php ---静态PHP页面

这是我的web.config文件:

<rewrite> 
      <rules> 
       <rule name="WPurls" enabled="true" stopProcessing="true"> 
        <match url=".*" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="index.php/{R:0}" /> 
       </rule> 
      </rules> 
     </rewrite> 

click to view my web.config file

回答

4

使用此代码在您的web配置:

<rewrite> 
     <rules> 
      <rule name="Imported Rule 1" stopProcessing="true"> 
       <match url="^(.*)$" /> 
       <conditions logicalGrouping="MatchAll"> 
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
        <add input="{REQUEST_FILENAME}.php" matchType="IsFile" ignoreCase="false" /> 
       </conditions> 
       <action type="Rewrite" url="{R:1}.php" /> 
      </rule> 
     </rules> 
    </rewrite> 
+0

感谢您的回复...其工作 – bharathi

+0

如果我添加此web.config文件静态PHP页面工作正常,但Wordpress页面给错误。 – bharathi

+0

你必须告诉你的网络服务器你正在使用默认页面的index.php页面。 – Sahadev