我的网站中有以下 .htaccess
文件 - 我必须将其重新定位到 Windows IIS 计算机,并且在使用 URL 重写模块导入规则和创建规则时遇到问题web.config
文件。
这是我的.htaccess
文件
# Rewrite URLs and direct to index.php
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
##
## If moving host, change the structure below to folder name of where public folder lives
##
RewriteBase /foldername/public
##
##
##
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>
它在 RewriteBase
上失败,但我知道 .htaccess
文件中的这一点对于我的网站正常运行至关重要。
谁能给我指点一下吗?
最佳答案
它将转换为以下网址重写规则:
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.+)$" ignoreCase="false" />
<conditions>
<!--##-->
<!--## If moving host, change the structure below to folder name of where public folder lives-->
<!--##-->
<!--##-->
<!--##-->
<!--##-->
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/foldername/public/index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
关于.htaccess - IIS 上的 rewritebase 的替代方案是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60253042/