【问题标题】:cakePHP and IIS8.5 : HTTP Error 404.0 - Not FoundcakePHP 和 IIS8.5:HTTP 错误 404.0 - 未找到
【发布时间】:2014-10-18 18:54:26
【问题描述】:

当我浏览到 localhost/admin/videos/view/1 时,我得到了我想要的页面。我还希望在浏览到 localhost/videos/view/1 时显示该页面。

但它给了我错误信息:

HTTP Error 404.0 - Not Found

Detailed Error Information:

Module        IIS Web Core
Notification  MapRequestHandler
Handler       StaticFile
Error Code    0x80070002
Requested URL http://{my-ip}/app/webroot/videos/view/1
Physical Path C:\inetpub\wwwroot\{my-project}\app\webroot\videos\view\1
Logon Method  Anonymous
Logon User    Anonymous

这些是我在 web.config 文件中的规则:

<rule name="Rewrite requests to test.php" stopProcessing="true">
   <match url="^test.php(.*)$" ignoreCase="false" />
   <action type="Rewrite" url="app/webroot/test.php{R:1}" />
</rule>
<rule name="Exclude direct access to app/webroot/*" stopProcessing="true">
   <match url="^app/webroot/(.*)$" ignoreCase="false" />
   <action type="None" />
</rule>
<rule name="Rewrite routed access to assets(img, css, files, js, fonts, vid, favicon)" stopProcessing="true">
   <match url="^(img|css|files|js|fonts|vid|favicon.ico)(.*)$" />
   <action type="Rewrite" url="app/webroot/{R:1}{R:2}" appendQueryString="false" />
 </rule>
 <rule name="Rewrite requested file/folder to index.php" stopProcessing="true">
    <match url="^(.*)$" ignoreCase="false" />
    <action type="Rewrite" url="index.php" appendQueryString="true" />
 </rule>

更新:

这有关系

&lt;match url="^(img|css|files|js|fonts|vid|favicon.ico)(.*)$" /&gt;

当我剪掉视频时| (这是我的视频目录)它显示 localhost/videos/view/1。

但是我遇到的问题是它无法加载我的视频。

【问题讨论】:

    标签: cakephp iis rewrite http-status-code-404


    【解决方案1】:

    我做了什么来解决这个问题:

    1我删除了里面的|vid

    <match url="^(img|css|files|js|fonts|favicon.ico)(.*)$" />
    

    2我将 webroot 中的 vid 文件夹替换为 files 文件夹,因为该文件夹是标准文件夹。

    3我把src改成了我视图中的视频

    <source src="/files/vid/...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-28
      • 2020-04-30
      • 2011-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多