IIS Url Rewrite results in 403 Forbidden

﹥>﹥吖頭↗ 提交于 2019-12-11 18:32:27

问题


UPDATE

After enabling direcorty listing it seems to have worked but now im running into another error.

Resource interpreted as Stylesheet but transferred with MIME type text/html

I'm trying to rewrite a URL to take content from the absolute directory.

Let's assume my URL was https://somesite.com/a <-- absolute path

This directory consist of files like index.html, contact.html and folders like css,js,img

But i want to access this directory with a URL like
https://somesite.com/a/somename/index which should take me to
https://somesite.com/a/index
but it should also keep the parameter somename in the URL therefore redirecting is not an option, this is because i need to use the Referrer Url later onwards from backend code.

My Rule

<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>

The above redirect works but it doesn't load the additional content inside the html files,
like js,css files which are all relative to the html file.

The below error is show when i enter the url https://somesite.com/a/someprofile/contact
The page from a\contact is displayed but not its relative content. The console is filled with this error

  Failed to load resource: the server responded with a status of 403 (Forbidden)

来源:https://stackoverflow.com/questions/55816876/iis-url-rewrite-results-in-403-forbidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!