【问题标题】:yii 2 not working. Object not found. What?yii 2 不工作。未找到对象。什么?
【发布时间】:2017-10-03 17:31:26
【问题描述】:

安装yii2 advanced并设置.htaccess

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L]
RewriteCond %{REQUEST_URI} !^/backend/web/(assets|js|css|js)/
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^.*$ backend/web/index.php [L]
RewriteCond %{REQUEST_URI} ^/(assets|css|js|images)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
RewriteRule ^(.*)$ frontend/web/$1 [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js)/
RewriteCond %{REQUEST_URI} !index.php
@ 987654342@
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
</IfModule>

点击链接 - /frontend/web/

我得到一个错误 -

其中可能有错误。我都按照说明做了?

【问题讨论】:

  • 只写 /frontend 没有 web
  • 没用,只写/frontend without web

标签: php .htaccess yii yii2 yii2-advanced-app


【解决方案1】:

显然它得到 404 错误。因为frontend/web 规则是使用 .htaccess 文件重写的。

localhost 中访问您的应用程序前端

http://localhost/your_project_directory_name/

【讨论】:

  • 如果我点击链接localhost,有我的项目,然后显示一个空白页面,没有错误。
  • 授予您项目目录的完全权限?
  • 设置权限,没有帮助
  • @RedSpace 使用的是哪个操作系统?
  • 安装在 Windows 7 上。打开服务器面板 - Windows 的本地 Web 服务器。
猜你喜欢
  • 2013-02-27
  • 1970-01-01
  • 2012-04-16
  • 1970-01-01
  • 2015-06-13
  • 1970-01-01
  • 2013-07-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多