.htaccess中和CakePHP 2在Windows IIS7 [英] Htaccess and CakePHP 2 on windows IIS7

查看:180
本文介绍了.htaccess中和CakePHP 2在Windows IIS7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题,尝试配置的mod-rewrite了窗户和II7: CakePHP的2.2.2不工作在Windows IIS7 但终于我可以为创建 web.config中文件IIS7导入htaccess的。

I was having problems trying to configure the mod rewrite over windows and II7: CakePHP 2.2.2 not working on Windows IIS7 but finally i could import the htaccess in order to create the web.config file for IIS7.

的事情是: 现在这个文件已经在CakePHP的文件夹中创建和我可以访问到主画面的可是尚未内部创建的应用程序/ 应用程序/ Web根目录在这里您可以找到2个.htaccess文件。

The thing is: Now that file has been created in cakephp folder and i can access to the main page BUT it has not been created inside app/ or app/webroot in which you can find 2 more .htaccess files.

现在,我无法访问除主网站的任何其他视图,它显示了一个404页没有发现错误,我是pretty的肯定,这是因为它没有得到在web.config中的.htaccess文件

Now, i can not access any other view than the main site, it shows a 404 page not found error and i am pretty sure that it is because it is not getting those .htaccess files on the web.config.

我的CakePHP的 web.config中文件看起来是这样的:

My cakephp web.config file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Imported Rule 1" stopProcessing="true">
                <match url="^$" ignoreCase="false" />
                <action type="Rewrite" url="app/webroot/" />
            </rule>
            <rule name="Imported Rule 2" stopProcessing="true">
                <match url="(.*)" ignoreCase="false" />
                <action type="Rewrite" url="app/webroot/{R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

虽然CakePHP的文档讲述了添加不同的code(这使得意见的工作,但没有风格被加载。和主页中不起作用。) <一href="http://book.cakephp.org/2.0/en/installation/advanced-installation.html#url-rewrites-on-iis7-windows-hosts" rel="nofollow">http://book.cakephp.org/2.0/en/installation/advanced-installation.html#url-rewrites-on-iis7-windows-hosts

Although the CakePHP documentation tells you to add a different code (which makes the views work but no styles are loaded. And the home page don't work.) http://book.cakephp.org/2.0/en/installation/advanced-installation.html#url-rewrites-on-iis7-windows-hosts

当试图从URL访问一个CSS文件,我得到这个消息:

When trying to access a CSS file from the URL i get this message:

Missing Controller

Error: CssController could not be found.

Error: Create the class CssController below in file: app\Controller\CssController.php

<?php
class CssController extends AppController {

}

你知道吗?使用CakePHP工作过的窗户是让我疯了...

Any idea? Working with Cakephp over windows is driving me crazy...

推荐答案

好吧,我终于得到它的工作使用该web.config中我发现这个网站: 的http://www2.palomar.edu/pages/sphillips/cakephp-with-iis-7-rewrite-rules-in-a-sub-folder/

Ok, finally i get it work using this web.config i found on this site: http://www2.palomar.edu/pages/sphillips/cakephp-with-iis-7-rewrite-rules-in-a-sub-folder/

我只是改变了 / {Path_To_CakePHP_Directory} / /

这篇关于.htaccess中和CakePHP 2在Windows IIS7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆