html - IIS Url Rewrite 导致 403 Forbidden
问题描述
更新
启用目录列表后,它似乎已经工作,但现在我遇到了另一个错误。
Resource interpreted as Stylesheet but transferred with MIME type text/html
我正在尝试重写 URL 以从绝对目录中获取内容。
假设我的 URL 是https://somesite.com/a <-- 绝对路径
这个目录由文件index.html, contact.html
和文件夹组成css,js,img
但是我想用应该带我去的URL
类似访问这个目录,但它也应该将参数保留在 URL 中,因此重定向不是一个选项,这是因为我需要从后端代码使用后面的代码。https://somesite.com/a/somename/index
https://somesite.com/a/index
somename
Referrer Url
我的规则
<rule name="StoreRewrite" stopProcessing="true">
<match url="^a/([^/]+)/([^/]+)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="a/{R:2}" />
</rule>
上面的重定向有效,但它不会加载 html 文件中的附加内容,
例如js,css
所有与 html 文件相关的文件。
当我输入 url 时显示以下错误https://somesite.com/a/someprofile/contact
页面a\contact
显示但不显示其相关内容。控制台充满了这个错误
Failed to load resource: the server responded with a status of 403 (Forbidden)
解决方案
推荐阅读
- javascript - 有人可以向我解释这应该如何纠正,对我来说这是有道理的,但我是新手
- docker - 我得到 [Errno 13] Permission denied: './docker-compose.yml' running docker
- android - 使用 Canvas Draw 方法查看位图不起作用
- java - 我不断收到 java.util.NoSuchElementException 错误
- ecmascript-6 - 使用扩展运算符组合对象内部的数组
- airflow - 我可以在airlfow中使用dockerOperator每次从git中提取相同的图像吗?
- regex - 正则表达式匹配包含两个字符串之一的路径
- python - 从python中的csv中查找字符串长度并附加字典格式的另一列
- sql - 了解 SQL 中的 BEFORE UPDATE 触发器
- python - 自定义身份验证每次在 Django 中返回 NULL