【发布时间】:2016-06-13 11:52:26
【问题描述】:
我正在尝试使用 IIS 和 从 Windows 服务器上的 URL 中删除 /frontend/web 和 /backend/web web.config 作为 .htaccess
的替代品我需要转换为 web.config 的原始 .htaccess 文件:
Options FollowSymlinks
RewriteEngine on
RewriteRule ^admin(.+)?$ backend/web/$1 [L,PT]
RewriteRule ^(.*)$ frontend/web/$1 [L]
我只能像这样使用 web.config 来删除 /frontend/web:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="RewriteRequestsToPublic" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" url="frontend/web/index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
这造成了一个问题,现在所有的图片、css和JS文件都不再加载,它们都给出404
当使用 /backend/web 时,这也不能解决我的问题,因为这假设要重写任何包含 admin 的网址。
【问题讨论】:
标签: php .htaccess iis web-config