2017-07-27 4 views
0

主にDjangoを実行しているAzurewebsitesにwordpressをインストールしました。私はアプリケーション設定で/ site/wwwroot/blogに/ blogとしてアプリケーションを設定しました。Azurewebsite django別のアプリケーション用のURL書き換え

しかし、web.configはurl www.example.com/blogを提供していません。代わりに、404エラーが発生しています。ここで

は、あなたがあなたの説明によると

<?xml version="1.0"?> 
<configuration> 
    <system.diagnostics> 
    <trace> 
     <listeners> 
     <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"> 
      <filter type="" /> 
     </add> 
     </listeners> 
    </trace> 
    </system.diagnostics> 
    <appSettings> 
    <add key="WSGI_ALT_VIRTUALENV_HANDLER" value="django.core.wsgi.get_wsgi_application()" /> 
    <add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\python.exe" /> 
    <add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_venv_handler()" /> 
    <add key="PYTHONPATH" value="D:\home\site\wwwroot" /> 

    <!-- 
    <add key="WSGI_PTVSD_SECRET" value="" /> 
    --> 
    </appSettings> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    <!-- Required for websockets. --> 
    <httpRuntime targetFramework="4.5"/> 
    </system.web> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <handlers> 
     <remove name="Python340_via_FastCGI" /> 
     <add name="Python FastCGI" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\Python34\python.exe|D:\Python34\Scripts\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" /> 
     <!-- Uncomment the following handler to enable remote debugging. --> 
     <!-- 
     <add name="ptvsd" path="ptvsd" verb="*" resourceType="Unspecified" type="Microsoft.PythonTools.Debugger.WebSocketProxy, Microsoft.PythonTools.WebRole"/> 
     --> 
     <!-- <clear/> 
     <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" /> 
     --> 
    </handlers> 
    <rewrite> 
     <rules> 
     <!-- Uncomment the following rule to enable remote debugging. --> 
     <!-- 
     <rule name="ptvsd" enabled="true" stopProcessing="true"> 
      <match url="^ptvsd(/.*)?$"/> 
     </rule> 
     --> 
     <rule name="Static Files" stopProcessing="true"> 
      <conditions> 
      <add input="true" pattern="false" /> 
      </conditions> 
     </rule> 
     <rule name="Configure Python" stopProcessing="true"> 
      <match url="(.*)" ignoreCase="false" /> 
      <conditions> 
      <add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" /> 
     </rule> 
     </rules> 
    </rewrite> 
    <staticContent> 
      <clientCache cacheControlMaxAge ="7.00:00:00" cacheControlMode="UseMaxAge" /> 
    </staticContent> 
    </system.webServer> 
</configuration> 

答えて

2

www.example.com/blogのためのリライトを無効にする方法を提案することができ、web.configファイルだ、私はあなたが条件と一致しない追加しようとする可能性が示唆しますルール

URLのターゲットがblobフォルダの場合は、書き換えません。

詳細については、下記の設定を参照してください。

<rule name="Configure Python" stopProcessing="true"> 
    <match url="(.*)" ignoreCase="false" /> 
    <conditions> 
    <add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" /> 
    <add input="{URL}" pattern="^/blog/.*" ignoreCase="true" negate="true" /> 
    </conditions> 
    <action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" /> 
</rule> 

結果は以下のようなものです:

enter image description here

+0

素晴らしい、うまく機能します。あなたの助けに感謝。 –

関連する問題