Remove index.php from wordpress URLs in iis7(从 iis7 中的 wordpress URL 中删除 index.php)
问题描述
我想从 url 中删除 index.php ,我正在使用 wordpress 和 iis7 .我该怎么做
I want to remove index.php from url , i am using wordpress and iis7 . how can i do this
推荐答案
使用这个 web.config
Use this web.config
(web.config是相当于apache webservers中的.htaccess文件的IIS,根目录下可以找到,没有的话需要自己创建一个.)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
 <defaultDocument>
     <!-- Set the default document -->
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
        <httpErrors errorMode="Detailed"/>
    <rewrite>
        <rules>
            <rule name="wordpress" patternSyntax="Wildcard">
                <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>
然后在永久链接页面中,设置自定义结构"并赋予值 /%postname%/
Then in permalinks page, set "Custom Structure" and give the value /%postname%/
请注意,需要安装特定于 IIS 版本的 URL 重写模块才能使其正常工作(感谢@Spikolynn 在下面的评论)
Note that URL Rewrite module specific to IIS version needs to be installed for this to function(Thanks to @Spikolynn's comment below)
这篇关于从 iis7 中的 wordpress URL 中删除 index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 iis7 中的 wordpress URL 中删除 index.php
 
				
         
 
            
        基础教程推荐
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php中的foreach复选框POST 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- php中的PDF导出 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
				 
				 
				 
				