yii2的web.config(.htaccess文件已提供)
我正在尝试在windows server上启动yii2网站 我的.htaccess文件:yii2的web.config(.htaccess文件已提供),yii2,web-config,Yii2,Web Config,我正在尝试在windows server上启动yii2网站 我的.htaccess文件: Options +FollowSymLinks IndexIgnore */* RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
但当我尝试将其转换为web.config文件(使用在线转换器)时,我收到了以下消息:
<rule name="rule 1i">
<match url="." />
<action type="Rewrite" url="index.php" />
</rule>
网站无法使用此web.config(错误500)。
请为我的.htaccess提供正确的web.config文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<sectionGroup name="system.webServer">
<sectionGroup name="rewrite">
<section name="rewriteMaps" overrideModeDefault="Allow" />
<section name="rules" overrideModeDefault="Allow" />
</sectionGroup>
</sectionGroup>
</configSections>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
@bizley我在这方面遇到了一些麻烦。它是路由URL,因为它们在物理路径中,而不是index.php?。。。有什么想法吗?
Options +FollowSymlinks
RewriteEngine On
# deal with admin first
RewriteCond %{REQUEST_URI} ^/advanced/(admin)
RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/advanced/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} ^/advanced/(admin)
RewriteRule ^.*$ backend/web/index.php [L]
RewriteCond %{REQUEST_URI} ^/advanced/(assets|css|js)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
RewriteCond %{REQUEST_URI} !^/advanced/(frontend|backend)/web/(assets|css)/
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php