[英]how to convert htaccess to web.config
我正在处理一个网站项目,并且必须将网站安装在客户端的服务器上。 他有一个Godaddy Windows帐户,该帐户不接受.htaccess文件,而是使用web.config。 我真的不知道怎么写web.config,我也很着急。 我试图用一些在线转换器来转换我的htaccess,但是当然它也不能正常工作。 你能帮我吗?
我的htaccess:
Options -Multiviews
RewriteEngine On
# Allow any files or directories that exist to be displayed directly
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME] !-d
RewriteCond %{REQUEST_FILENAME] !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
生成器从中生成的内容为web.config:
<rule name="rule 1w" stopProcessing="true">
<match url="^" />
<action type="Rewrite" url="/-" />
</rule>
<rule name="rule 2w" stopProcessing="true">
<match url="^(.+)$" />
<action type="Rewrite" url="/index.php?url={R:1}" appendQueryString="true"/>
</rule>
Aaand我在发布此问题后2分钟内解决了问题!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<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?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.