我遵循了Codeigniter 2 on IIS with web.config file代码,但是在htaccess中,由于我对htaccess和web.config不太了解,所以我有更多的代码不知道如何转换
这是htaccess,我目前正在linux服务器的codeigniter中使用它。
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
#RewriteCond %{HTTPS} on
#RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
DirectoryIndex index.php
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
php_value memory_limit 512M
php_value post_max_size 512M
php_value upload_max_filesize 512M
这是我到目前为止在web.config中所做的事情。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<!-- maxRequestLength and requestLengthDiskThreshold, for IIS6 or lower, in KiB
requestLengthDiskThreshold should be equal or less than maxRequestLength
(Eg. 512MiB = 512*1024 = 524288KiB)
-->
<httpRuntime maxRequestLength="524288" executionTimeout="3600" requestLengthDiskThreshold="524288" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- maxAllowedContentLength, for IIS7 or higher, in Bytes
(Eg. 512MiB = 512*1024*1024 = 536870912Bytes)
-->
<requestLimits maxAllowedContentLength="536870912" />
</requestFiltering>
</security>
<rewrite>
<rules>
<clear />
<!--<rule name="Redirect to http" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" redirectType="Temporary" appendQueryString="true" />
</rule>-->
<!--<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Temporary" appendQueryString="true" />
</rule>-->
<rule name="Index" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{R:1}" pattern="^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
现在看htaccess的第11行,我认为我没有正确转换该行。 确定我在做什么错的任何帮助。如果发现其他任何错误,也请提及。我没有任何Windows Web服务器或托管服务器,所以我现在无法测试,但是会提供任何帮助。我必须将此项目交给客户,他们将自行部署。因此,web.config是必需的。任何答案都将对将来的代码点火器开发和部署有所帮助。