1

したがって、基本的にはすべてのリクエストをindex.phpに送信するため、次のようになりhttp://example.com/articleますhttp://example.com/index.php?page=article

mod_rewrite ではうまく機能しますが、IIS7 ( web.config ) では特定のケースでは機能しません。

APACHE ( mod_rewrite / .htaccess )

    http://example.com/members .... Works!
    http://example.com/article&id=1 .... Works!

しかし..

IIS ( web.config )
    http://example.com/members .... Works!
    http://example.com/article&id=1 .... 'Bad Request'

これを修正するにはどうすればよいですか?

私の.htaccess

RewriteEngine on

RewriteBase /
RewriteCond  %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule  ^(.*)$ index.php?page=$1 [QSA,L]

私のweb.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Imported Rule 1-1" stopProcessing="true">
                    <match url="^buddy" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 1">
                    <match url="^(|/)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Rewrite" url="index.php?page={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 2">
                    <match url="^([a-zA-Z0-9/_-]+)(|)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Rewrite" url="index.php?page={R:1}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
        <defaultDocument>
            <files>
                <remove value="iisstart.htm" />
                <remove value="Default.asp" />
                <remove value="Default.htm" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>
4

0 に答える 0