Cakephp Url在IIS服务器中重写问题

时间:2014-09-09 09:16:26

标签: cakephp iis

我在IIS服务器中遇到了Cakephp Url重写问题,它在appache服务器上的.htaccess不能正常工作,我从Cakephp网站获得了iis服务器的web.config代码,这个

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
     <rewrite>
        <rules>
            <rule name="Rewrite requests to test.php"
              stopProcessing="true">
                <match url="^test.php(.*)$" ignoreCase="false" />
                <action type="Rewrite" url="app/webroot/test.php{R:1}" />
            </rule>
            <rule name="Exclude direct access to app/webroot/*"
              stopProcessing="true">
                <match url="^app/webroot/(.*)$" ignoreCase="false" />
                <action type="None" />
            </rule>
            <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
              stopProcessing="true">
                <match url="^(img|css|files|js|favicon.ico)(.*)$" />
                <action type="Rewrite" url="app/webroot/{R:1}{R:2}"
                  appendQueryString="false" />
            </rule>
            <rule name="Rewrite requested file/folder to index.php"
              stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <action type="Rewrite" url="index.php"
                  appendQueryString="true" />
             </rule>
         </rules>
     </rewrite>
 </system.webServer>
</configuration>

它部分工作,例如当我到达mysite时,url会自动重定向到 http://example.com/app/webroot/index.php,我可以看到所有图片和样式,但是当我点击一些链接例如http://example.com/products/allproducts/时,它显示500错误,但是这个网址在.htacess的appache服务器中工作, 但是当我使用类似这个http://example.com/app/webroot/index.php/products/allproducts的链接时,它可以工作,但是所有的图像和样式都被破坏了,我如何解决这个问题?,我需要一个像http://example.com/products/allproducts/一样正常工作的网址,请帮助我们,

注意: - 我使用Cakephp 1.2.5版本

0 个答案:

没有答案