自定义域的子目录导航到Azure Web应用程序 [英] Custom domain's sub-directory navigate to azure web app
问题描述
我有一个域名"www.example.com",它托管在我自己的服务器上.
I have a domain "www.example.com" and it is hosting on my own server.
现在,我希望"www.example.com/sub-directory/"可以导航到我的Azure Web应用"xxx.azurewebsites.net",因此我在服务器上设置了反向代理,但是页面(www.example.com/sub-directory/)显示404错误,如下所示:
Now I hope "www.example.com/sub-directory/" could navigate to my Azure web app "xxx.azurewebsites.net", so I set up reverse proxy on my server, but the page (www.example.com/sub-directory/) showed 404 error as below:
-------
-------
如何解决此问题?
推荐答案
你好Immyxm,
Hello Immyxm,
您正在寻找的是URL重写( URL重写)
您必须下载此扩展并将其安装到IIS中,然后创建一条规则,以从"www.example.com/sub-directory-name/"您的Azure Web应用程序发生了.
What you are looking for is URL Rewrite (URL Rewrite)
You have to download and install this extension into your IIS and then create a rule that will make the rewrite from "www.example.com/sub-directory-name/" to your azure webapp happen.
在此之后,您应该将规则添加到您的web.config中,如下所示:
After this you should add a rule to your web.config that looks like this:
<规则名称="从子目录重定向到www.newURL.com" stopProcessing ="true"; enabled ="true">
< match url =(.*)" ignorecase ="true"; />
< conditions>
< add input =" {HTTP_HOST}" pattern =" ^(子目录名称\.)(.*)
<rule name="Redirect from sub-directory to www.newURL.com" stopProcessing="true" enabled="true">
<match url="(.*)" ignorecase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(sub-directory-name\.)(.*)
" />
</conditions>
< actions type =重定向"; url =" http://www.newURL.com/" redirectType =永久" />
</rule>
" />
</conditions>
<actions type="Redirect" url="http://www.newURL.com/" redirectType="Permanent" />
</rule>
希望这有帮助吗?
这篇关于自定义域的子目录导航到Azure Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!