将web.config文件转换为.htaccess
我正在寻找将IIS重写规则转换为.htaccess文件的方法。我找不到任何工具来自动执行此操作,我只能得到500个内部服务器错误 web.config文件如下所示:将web.config文件转换为.htaccess,.htaccess,iis,web-config,.htaccess,Iis,Web Config,我正在寻找将IIS重写规则转换为.htaccess文件的方法。我找不到任何工具来自动执行此操作,我只能得到500个内部服务器错误 web.config文件如下所示: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <c
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="RemoveTrailingSlash" stopProcessing="true">
<match url="^(.*?)/+$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/{R:1}" />
</rule>
<rule name="HaltOnTinyMCE" stopProcessing="true">
<match url="^tinymce/.*$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<rule name="RewriteContent" enabled="true" stopProcessing="true">
<match url="^.*\.(gif|jpg|png|css|js|swf|txt|xml)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="domains/{HTTP_HOST}/{R:0}" appendQueryString="true" logRewrittenUrl="false" />
</rule>
<rule name="RewritePages" enabled="true">
<match url="^.*$" ignoreCase="true" negate="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="index.php" logRewrittenUrl="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
提前谢谢 你正朝着正确的方向前进,但是有一些错误和不必要的东西。这就是我想到的:
RewriteEngine on
RewriteBase /
#remove tailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L]
# stop rules below from being applied if url starts with tinymce/
RewriteRule ^tinymce/.*$ - [L]
#rewrite images etc. to domains folder (unless url already starts with domain/)
RewriteCond $0 !^domains/
RewriteRule ^.*\.(gif|jpg|png|css|js|swf|txt|xml)$ domains/%{HTTP_HOST}/$0 [L]
#catch all other (I added 2 rewriteconds, to prevent rewriting existing files (including index.php))
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
是啊,那奏效了。非常感谢你摆脱了那些讨厌的虫子:)
RewriteEngine on
RewriteBase /
#remove tailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L]
# stop rules below from being applied if url starts with tinymce/
RewriteRule ^tinymce/.*$ - [L]
#rewrite images etc. to domains folder (unless url already starts with domain/)
RewriteCond $0 !^domains/
RewriteRule ^.*\.(gif|jpg|png|css|js|swf|txt|xml)$ domains/%{HTTP_HOST}/$0 [L]
#catch all other (I added 2 rewriteconds, to prevent rewriting existing files (including index.php))
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php