Heim > Backend-Entwicklung > PHP-Tutorial > yii2 除了主页其他的页面都是404 Not Found

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-06 20:08:59
Original
1239 Leute haben es durchsucht

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文件

<code class="htaccess">Options +FollowSymLinks
IndexIgnore /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</code>
Nach dem Login kopieren
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
PHP-Datenerfassung?
Aus 1970-01-01 08:00:00
0
0
0
PHP-Erweiterung intl
Aus 1970-01-01 08:00:00
0
0
0
Wie man PHP gut lernt
Aus 1970-01-01 08:00:00
0
0
0
Mehrere PHP-Versionen
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage