php CakePHP:未在您的服务器上正确配置 URL 重写
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7014651/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CakePHP: URL rewriting is not properly configured on your server
提问by Emanuel
When I try to run my project (made with cakephp framework), I receive this error:
当我尝试运行我的项目(使用 cakephp 框架制作)时,我收到此错误:
URL rewriting is not properly configured on your server. Help me configure it I don't / can't use URL rewriting
您的服务器上未正确配置 URL 重写。帮我配置一下我不会/不能使用URL重写
I checked apache httpd.conf file and everything look ok. How can I fix this?
我检查了 apache httpd.conf 文件,一切正常。我怎样才能解决这个问题?
Thanks.
谢谢。
采纳答案by deizel
回答by Costa
Ugh. Before you go nuts testing out your Apache config, make sure cake.generic.css
is available in your app/webroot/css/
folder. This is a very misleading error message.
啊。在开始测试 Apache 配置之前,请确保cake.generic.css
在您的app/webroot/css/
文件夹中可用。这是一个非常具有误导性的错误消息。
The state of URL rewriting is being checked indirectly by checking for access to cake.generic.css
(which would only be found if url rewriting is working).
URL 重写的状态是通过检查访问来间接检查的cake.generic.css
(只有在 url 重写工作时才会发现)。
The red error box in the default home.ctp
is ALWAYS shown by default. Then the styling in cake.generic.css
will hide it via
默认情况下home.ctp
始终显示默认的红色错误框。然后样式cake.generic.css
将通过
#url-rewriting-warning {
display:none;
}
But that means if the cake.generic.css
file is not found (e.g. because you deleted it to use your own CSS), the error box will notbe hidden, even though URL rewriting is working perfectly fine.
但这意味着如果cake.generic.css
找不到文件(例如,因为您删除它以使用自己的 CSS),即使 URL 重写工作正常,错误框也不会隐藏。
So basically, ignore the URL rewriting error on the default homepage. Try to access one of your controller+views and see if it works.
所以基本上,忽略默认主页上的 URL 重写错误。尝试访问您的控制器+视图之一,看看它是否有效。
回答by user699334
I just got the same problem. The cause was the database config. I solved it by changing this in the database.php file:
我刚刚遇到了同样的问题。原因是数据库配置。我通过在 database.php 文件中更改它来解决它:
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',...
to this (rockies, please don't copy the '...' part):
对此(落基山脉,请不要复制“...”部分):
class DATABASE_CONFIG {
public $default = array(
'driver' => 'mysql',...
Note: I am working on old cakephp 1.3.10
注意:我正在处理旧的 cakephp 1.3.10
回答by buttonpol
I had the same problem, having all server configured. I've finally found this discussion. My problem appeared when I created a default.ctp in app/layouts with some errors. I was calling:
我遇到了同样的问题,配置了所有服务器。我终于找到了这个讨论。当我在 app/layouts 中创建一个 default.ctp 时出现了一些错误,我的问题就出现了。我打电话给:
echo $this->element('fancybox_links');
when that element wasn't ready and solved it by creating that element. So if you have this problem and your httpd.conf seems to be right, check for another cause.
当该元素未准备好并通过创建该元素解决它时。因此,如果您遇到此问题并且您的 httpd.conf 似乎是正确的,请检查其他原因。
回答by TiCL
I have experienced similar issues when there was a problem with DB connectivity or extension loading (MSSQL on Windows). It is very likely not a URL rewriting issue. Since your phpmyadmin isn't working either check MySQL configuration.
当数据库连接或扩展加载(Windows 上的 MSSQL)出现问题时,我遇到了类似的问题。这很可能不是 URL 重写问题。由于您的 phpmyadmin 不起作用,请检查 MySQL 配置。