【问题标题】:URL rewriting is not properly configured on your server. 1) Help me configure it 2) I don't / can't use URL rewriting您的服务器上未正确配置 URL 重写。 1) 帮我配置它 2) 我不/不能使用 URL 重写
【发布时间】:2013-09-11 21:34:19
【问题描述】:

我得到了 cakePHP,但出现以下错误。

您的服务器上未正确配置 URL 重写。 1) 帮我配置 2) 我不/不能使用 URL 重写

奇怪的是,它在我的笔记本电脑上运行良好,而在我的台式电脑上却无法运行。我从笔记本电脑复制整个内容并将其粘贴到桌面上,然后显示该错误。

有什么想法可以解决吗?我按照步骤解决,但这是同样的问题。我的 cakePHP 版本是 2.0 以上。

【问题讨论】:

  • url 重写真的有效吗?我发现 Cake 有时会误诊这个错误。
  • 是的。我从笔记本电脑复制整个 cakephp 文件夹并将其粘贴到桌面上。它在我的笔记本电脑上运行良好。只发生在桌面上。
  • 我修好了。谢谢你。我必须按照教程中的步骤进行操作。

标签: cakephp


【解决方案1】:

您可以先在apache/conf/httpd.conf 文件中检查您的重写模式是否开启。 检查httpd.conf文件中的以下代码:

LoadModule rewrite_module modules/mod_rewrite.so

删除此行中的哈希并重新启动 Apache 服务器:

#sudo service apache2 restart

之后,您可以在 cakephp .htaccess 文件中设置以下代码:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /YourPath/
    RewriteRule    ^$    app/webroot/      [L]
    RewriteRule    (.*)  app/webroot/$1    [L]       
 </IfModule>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-24
    • 1970-01-01
    • 2012-01-09
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2021-05-16
    • 1970-01-01
    相关资源
    最近更新 更多