Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
如何在godaddy windows托管计划的web.config文件中创建.htaccess重写规则_.htaccess_Iis_Mod Rewrite_Url Rewriting_Web Config - Fatal编程技术网

如何在godaddy windows托管计划的web.config文件中创建.htaccess重写规则

如何在godaddy windows托管计划的web.config文件中创建.htaccess重写规则,.htaccess,iis,mod-rewrite,url-rewriting,web-config,.htaccess,Iis,Mod Rewrite,Url Rewriting,Web Config,我更新使用web.config。我在本地主机上创建了.htaccess文件,但由于windows主机计划,它在godaddy主机上不起作用。我不知道如何在web.config文件中创建重写规则。我的.htaccess重写规则如下所述。 请帮帮我。谢谢 # Options +FollowSymLinks RewriteBase / RewriteEngine on RewriteRule home$ index.php?page_id=1 [NC] RewriteRule blog$ inde

我更新使用web.config。我在本地主机上创建了.htaccess文件,但由于windows主机计划,它在godaddy主机上不起作用。我不知道如何在web.config文件中创建重写规则。我的.htaccess重写规则如下所述。 请帮帮我。谢谢

# Options +FollowSymLinks

RewriteBase /
RewriteEngine on

RewriteRule home$ index.php?page_id=1 [NC]
RewriteRule blog$ index.php?page_id=2 [QSA]
RewriteRule privacy$ index.php?page_id=3 [NC]
RewriteRule contact$ index.php?page_id=4 [NC]
您没有为IIS创建.htaccess。如果它没有运行Apache,它将无法工作。Web配置仅适用于运行IIS的Windows。没有什么能让这一切都起作用。您必须将其转换为IIS重写规则,或者使用Linux/Apache或Windows/Apache托管计划

尝试在线转换器站点。这里有一个可能有效

查看此web.config重写是否有效

<rule name="rule 1L">
    <match url="home$"  ignoreCase="true" />
    <action type="Rewrite" url="/index.php?page_id=1"  />
</rule>
<rule name="rule 2L">
    <match url="blog$"  />
    <action type="Rewrite" url="/index.php?page_id=2"  appendQueryString="true" />
</rule>
<rule name="rule 3L">
    <match url="privacy$"  ignoreCase="true" />
    <action type="Rewrite" url="/index.php?page_id=3"  />
</rule>
<rule name="rule 4L">
    <match url="contact$"  ignoreCase="true" />
    <action type="Rewrite" url="/index.php?page_id=4"  />
</rule>

首先清空web.config文件,请尝试仅复制上述代码并粘贴到web.config文件中 我希望它能起作用。。。 您的web.config文件必须位于根目录中

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="rule 1f">
                  <match url="home$"  ignoreCase="true" />
                  <action type="Rewrite" url="/index.php?page_id=1"  />
                </rule>
                <rule name="rule 2f">
                 <match url="blog$"  />
                 <action type="Rewrite" url="/index.php?page_id=2" ppendQueryString="true" />
                </rule>
                <rule name="rule 3f">
                 <match url="privacy$"  ignoreCase="true" />
                 <action type="Rewrite" url="/index.php?page_id=3"  />
                </rule>
                <rule name="rule 4f">
                  <match url="contact$"  ignoreCase="true" />
                  <action type="Rewrite" url="/index.php?page_id=4"  />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>  

类似的情况如上所述-请有人确认,如果下面的网络配置将工作?