不要在root url上返回index.hmtl而是返回403拒绝访问

时间:2017-12-01 15:32:49

标签: redirect iis azure-web-sites url-redirection

当我输入www.mydomain.com时,会返回index.html文件。

我不想那样。

在基本网址上我想要返回403访问被拒绝,我该怎么做

只有当附加基本网址和其他路由/路径时,我才想要

加载index.html,因为然后前端可以捕获路由值

最初用于进一步的后端呼叫。

1 个答案:

答案 0 :(得分:0)

  

在基本网址上我想返回403 Access被拒绝,我该怎么做?

根据您的要求,您可以利用以下网址重写规则:

Toolbar  toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle("New");
    getSupportActionBar().setLogo(R.mipmap.ic_launcher);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

此外,您还可以删除蔚蓝网络应用的<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Block the request from the root url and return 403" stopProcessing="true"> <match url="^$" /> <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied."/> </rule> </rules> </rewrite> </system.webServer> </configuration> 下的index.html文档,如下所示:

enter image description here