求大神帮忙把iis的web.config转换为apache的.htaccess规则
<configuration><system.webServer><rewrite><rules><rulename="asd1"><matchurl="^k/(\d+)...
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="asd1">
<match url="^k/(\d+)$" ignoreCase="false" />
<action type="Rewrite" url="index.php/home/other/prizes_href?redprizeid={R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration> 展开
<system.webServer>
<rewrite>
<rules>
<rule name="asd1">
<match url="^k/(\d+)$" ignoreCase="false" />
<action type="Rewrite" url="index.php/home/other/prizes_href?redprizeid={R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration> 展开
展开全部
^t_(\d+).html$ t.php?id=$1
这个在apache下面可以,但在iis下的isapi_rewrite里可能就不对了
要改成 ^(.*)/t_(\d+).html$ $1/t.php\?id=$2
加了/,和对?进行了转义
Apache下
RewriteRule ^company/show_([0-9]+).html$ company.php?uid=$1 [L] //正确,可以不转义. ?
RewriteRule ^company/show_([0-9]+)\.html$ company.php\?uid=$1 [L] //正确
RewriteRule ^/company/show_([0-9]+)\.html$ /company.php\?uid=$1 [L] //错误 加了/就不行了
IIS下
RewriteRule ^(.*)/resume/([0-9]+)/show\.html$ /$1/person.php?pid=$2 [L] // 正确
RewriteRule ^(.*)/resume/([0-9]+)/show.html$ /$1/person.php?pid=$2 [L] //错误,.?必须转义
RewriteRule /resume/([0-9]+)/show\.html$ /person.php\?pid=$1 [L] // 正确
RewriteRule resume/([0-9]+)/show\.html$ person.php\?pid=$1 [L] // 错误,必须加/
RewriteRule /resume/([0-9]+)/show\.html$ /person.php?pid=$1 [L] // 错误,?必须转义
总结 iis下必须加 /,.?必须转义
apache下不能加/
这个在apache下面可以,但在iis下的isapi_rewrite里可能就不对了
要改成 ^(.*)/t_(\d+).html$ $1/t.php\?id=$2
加了/,和对?进行了转义
Apache下
RewriteRule ^company/show_([0-9]+).html$ company.php?uid=$1 [L] //正确,可以不转义. ?
RewriteRule ^company/show_([0-9]+)\.html$ company.php\?uid=$1 [L] //正确
RewriteRule ^/company/show_([0-9]+)\.html$ /company.php\?uid=$1 [L] //错误 加了/就不行了
IIS下
RewriteRule ^(.*)/resume/([0-9]+)/show\.html$ /$1/person.php?pid=$2 [L] // 正确
RewriteRule ^(.*)/resume/([0-9]+)/show.html$ /$1/person.php?pid=$2 [L] //错误,.?必须转义
RewriteRule /resume/([0-9]+)/show\.html$ /person.php\?pid=$1 [L] // 正确
RewriteRule resume/([0-9]+)/show\.html$ person.php\?pid=$1 [L] // 错误,必须加/
RewriteRule /resume/([0-9]+)/show\.html$ /person.php?pid=$1 [L] // 错误,?必须转义
总结 iis下必须加 /,.?必须转义
apache下不能加/
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询