扫码关注官方订阅号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
https://github.com/yiisoft/yii2/blob/master/docs%2Fguide%2Fstart-installation.md#recommended-apache-configuration-
yii2的路由不是这样访问的。。。要访问frontend\controllers\SiteController正确的url应该是xxx.com/index.php/site或xxx.com/site而不是xxx.com/frontend/web/site
frontend\controllers\SiteController
xxx.com/index.php/site
xxx.com/site
xxx.com/frontend/web/site
至于为什么xxx.com/index.php能直接访问到project/frontend/web/index.php,这是要给你的nginx/apache写路由重写规则来实现的。
xxx.com/index.php
project/frontend/web/index.php
你需要在web目录加个.htaccess文件
Options +FollowSymLinks IndexIgnore / RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
https://github.com/yiisoft/yii2/blob/master/docs%2Fguide%2Fstart-installation.md#recommended-apache-configuration-
yii2的路由不是这样访问的。。。
要访问
frontend\controllers\SiteController正确的url应该是
xxx.com/index.php/site或xxx.com/site而不是xxx.com/frontend/web/site至于为什么
xxx.com/index.php能直接访问到project/frontend/web/index.php,这是要给你的nginx/apache写路由重写规则来实现的。你需要在web目录加个.htaccess文件