Home > Backend Development > PHP Tutorial > yii2 除了主页其他的页面都是404 Not Found

yii2 除了主页其他的页面都是404 Not Found

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:08:59
Original
1241 people have browsed it

yii2 除了主页其他的页面都是404 Not Found
yii2 除了主页其他的页面都是404 Not Found

回复内容:

yii2 除了主页其他的页面都是404 Not Found
yii2 除了主页其他的页面都是404 Not Found

https://github.com/yiisoft/yii2/blob/master/docs%2Fguide%2Fstart-installation.md#recommended-apache-configuration-

yii2的路由不是这样访问的。。。
要访问frontend\controllers\SiteController
正确的url应该是xxx.com/index.php/sitexxx.com/site而不是xxx.com/frontend/web/site

至于为什么xxx.com/index.php能直接访问到project/frontend/web/index.php,这是要给你的nginx/apache写路由重写规则来实现的。

你需要在web目录加个.htaccess文件

Options +FollowSymLinks
IndexIgnore /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template