1
我正在尋找一種方法將我的IIS重寫規則轉換爲.htaccess文件。我無法找到任何工具來自動執行此操作,而我所能得到的所有內容都是500內部服務器錯誤。將web.config文件轉換爲.htaccess
web.config文件看起來是這樣的:
<?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>
我最好的嘗試在手動轉換這仍然給我500內部服務器錯誤。有什麼建議麼?
RewriteEngine on
RewriteCond /+$
RewriteRule ^(.*?)/+$ http://{HTTP_HOST}/$1 [R=301,L]
RewriteCond ^tinymce/.*$
RewriteRule ^(.*)$ $1 [L]
RewriteCond \.(gif|jpg|png|css|js|swf|txt|xml)$
RewriteRule ^.*\.(gif|jpg|png|css|js|swf|txt|xml)$ domains/{HTTP_HOST}/$1 [L]
RewriteRule ^.*$ index.php
在此先感謝!
耶,工作。非常感謝您擺脫那些討厭的bug :) – 2012-03-07 10:09:38
Graag gedaan ... – Gerben 2012-03-07 15:47:14