在您的服务器上未正确配置Cakephp 2.x URL重写

Pap*_*nho 2 .htaccess mod-rewrite cakephp

我想我们大多数人都遇到麻烦.htaccess我想知道是否有人可以帮助我.Opensuse 12.3:代码:

Linux linux-hyo0.site 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

我喜欢在我的机器上安装Cakephp,但我的网页上有一个错误,上面写着"代码: 你的服务器上没有正确配置URL重写 ".

我的/ etc/sysconfig/apache2文件如下:代码:

APACHE_MODULES="authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap php5 reqtimeout authz_default rewrite"
Run Code Online (Sandbox Code Playgroud)

并将/etc/apache2/sysconfig.d/loadmodule.conf作为最后一行代码:

LoadModule rewrite_module                 /usr/lib64/apache2/mod_rewrite.so
Run Code Online (Sandbox Code Playgroud)

我也改变了我的文件etc/apache2/defaul-server.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory "/srv/www/htdocs">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride ALL
    Order Allow,Deny
    Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)

有帮助吗?

在app/webroot上

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

并在app /

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

Jel*_*ema 6

这是一个相当古老的问题,但也许这个答案对你来说与谷歌用户有关:

您是否更改了View/Layouts/default.ctp?

这是警告发生的情况:

  • 警告在View/Pages/home.ctp中的div中设置
  • 在home.ctp中,仅在文件app/webroot/css/cake.generic.css存在时设置警告
  • 在标准的default.ctp布局中,加载样式表/css/cake.generic.css
  • 在cake.generic.css中带有警告的div是......隐藏!!!

那么当默认主页加载时会发生什么:它尝试加载cake.generic.css样式表,当正确配置mod_rewrite时成功.那么警告就被隐藏了.如果无法加载样式表,则警告将保持可见.

简而言之,当mod_rewrite和htaccess出现问题时,或者您更改布​​局以便不再加载cake.generic.css时,会弹出此警告...

首先检查您是否尝试加载样式表.它会出现在您的F12控制台中吗?