2017-01-13 21 views
0

こんにちは私はMicrosoft AzureでホストされているcodeigniterアプリケーションのHTTPSへのすべてのHTTPリクエストをリダイレクトしようとしています。 web.configファイルに次のコードを挿入しましたが、リダイレクトが機能していないようです。HTTPリダイレクトをHTTPSにリダイレクトCodeigniterをMicrosoft Azureにデプロイ

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
      <!-- BEGIN rule TAG FOR HTTPS REDIRECT --> 
      <rule name="Force HTTPS" enabled="true"> 
       <match url="(.*)" ignoreCase="false" /> 
       <conditions> 
       <add input="{HTTPS}" pattern="off" /> 
       </conditions> 
       <action type="Redirect" url="https://{HTTP_HOST}" appendQueryString="true" redirectType="Permanent" /> 
      </rule> 
      <!-- END rule TAG FOR HTTPS REDIRECT --> 
      <rule name="Rewrite to index.php"> 
       <match url="index.php|robots.txt|images|test.php" /> 
       <action type="None" /> 
      </rule> 
      <rule name="Rewrite CI Index"> 
       <match url=".*" /> 
       <conditions> 
        <add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html" negate="true" /> 
       </conditions> 
       <action type="Rewrite" url="index.php/{R:0}" /> 
      </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 

設定が必要なファイルがありますか?私はフックを作成するだけでなく、.htaccessファイルを変更しようとしました。

web.configファイルでHTTPSリダイレクトが機能しない理由を知りたい場合や、その他の手順が必要な場合は、動作させる必要があります。

ありがとうございます!

+0

更新情報がありますか? –

答えて

0

あなたのweb.configファイルをCodeIgniterアプリで試したところ、リダイレクトアクションが正しく機能しました。

ここではフォルダ構造: enter image description here

は、だからあなたの設定ファイルは、実際に罰金です。 web.configファイルが/wwwrootディレクトリにあることを確認してください。

https://<yourwebsitename>.scm.azurewebsites.net/SiteExtensions#galleryからアクセスできるKuduサイト拡張機能を使用して、Redirect HTTP to HTTPSというサイト拡張をインストールすることもできます。検索ボックスで

  1. によって

    ステップは、 "をリダイレクト" と入力し、その後検索ボタンをクリックしてください。 enter image description here

  2. Redirect HTTP to HTTPSを選択し、ADDをクリックします。
  3. ダイアログが開き、Installボタンをクリックします。
  4. Restart Siteボタンをクリックして利用可能にするには、
関連する問題