0

Windows サーバーを使用している場合、index.html をルートにリダイレクトできる可能性はありますか。

www.example.com/index.html    -> www.example.com
http://example.com/index.html -> http://example.com 

現在使用しているホスティングは Apache ではなく、Windows サーバーを使用しています。

4

1 に答える 1

1

さらに別の編集:

メタリフレッシュタグ

<meta http-equiv="refresh " content="0; url=www.example.com">

メタ リフレッシュ タグが機能しない場合は、他に 2 つのオプションを試すことができます。

デフォルトのドキュメントを設定します。(簡単)

Web.Config 設定:

<system.webServer>
<defaultDocument enabled="true">
    <files>
        <clear />
        <add value="index.html" />
    </files>
</defaultDocument>
</system.webServer>

web.config による設定の詳細: IIS 7.5 で既定の Web ページを設定する

または IIS UI を介してセットアップします (HOW TO セクションの手順 1 から 8): https://www.iis.net/configreference/system.webserver/defaultdocument

IIS で書き換えルールを作成します。(より困難)

Apache を使用している場合は、.htaccess ファイルのルールを作成/更新します。

RewriteEngine On
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]

IIS では、これらの書き換えルールを別の方法で web.config に追加する必要があります。以下のリンクを参照してください。

web.config で書き換えルールを作成する手順: IIS URL 書き換えと Web.config

.htaccess コンテンツを IIS web.config に変換する方法の詳細: http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to- iis-webconfig

または IIS UI で書き換えルールを作成します: http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

于 2016-05-23T00:34:54.700 に答える