ubuntu - 在 ubuntu 的 cakephp 项目中,在此服务器上找不到请求的 URL/users/login

标签 ubuntu cakephp apache2 ubuntu-16.04 htdocs

我已经在 ubuntu 服务器上上传了一个完整的 cakephp 项目,这里我使用了 apache2。

我的项目在我的 locak 服务器(xampp)中正常工作,但在服务器中显示此错误:

The requested URL /users/login was not found on this server.



我的项目位于var/www/html .

这是我的.htdocs文件:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ app/webroot/  [L]
    RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

我需要一个适当的解决方案。

最佳答案

检查 apache 配置文件是否有 rewrite_module 行并且它没有被注释:

/etc/apache2/apache2.conf

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

还要确保您的覆盖和符号链接(symbolic link)选项在上述 apache 配置中是正确的:
<Directory />
    Options FollowSymLinks
    AllowOverride All
#    Order deny,allow
#    Deny from all
</Directory>

根据您的 cakephp 版本,.htaccess 应该像这些。

应用程序/.htacces 蛋糕PHP 2:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1    [L]
</IfModule>

/.htacces 蛋糕PHP 3:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

webroot/.htaccess 两个版本:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

关于ubuntu - 在 ubuntu 的 cakephp 项目中,在此服务器上找不到请求的 URL/users/login,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43398851/

相关文章:

linux - 以访客用户身份登录时,如何以编程方式重启 Ubuntu?

cakephp 2, 编辑表单创建一个新记录而不是更新它

apache - apache2、apache2-threaded-dev 和 apache-prefork-dev 之间的区别

CakePHP 3.0 -> 查找条件之间

python - Apache2 + RewriteMap + Python——返回 'NULL' 时,apache 挂起

php - mod_rewrite 无法在 Ubuntu 上使用 apache2

unix - 无法让 cron 在 Amazon EC2 上运行?

python - 带有 print json 的 Ffprobe 不打印任何内容

ubuntu - 在 Emacs 中将功能键绑定(bind)到 CTRL

javascript - bootstrap 3确认删除cakephp中的模式