So entfernen Sie index.php vom Server
服务器中去掉index.php的方法:1、打开php.ini文件,更改内容为“cgi.fix_pathinfo=1”;2、修改对应虚拟主机的配置文件;3、将“include enable-php.conf;”替换为“include enable-php-pathinfo.conf;”;4、去掉index.php,重启lnmp即可。
本教程操作环境:windows10系统、php7.0版、DELL G3电脑
服务器中怎么去掉index.php?
url中去掉index.php方法:
THINKPHP官方论坛和网络上很多NGINX配置教程不是太完善的。我一直比较喜欢使用lnmp.org配置服务器环境。所以本文将介绍 LNMP 配置NGINX 支持THINKPHP PATHINFO模式 。
thinkphp的url访问:http://serverName/index.php(或者其它应用入口文件)/模块/控制器/操作/[参数名/参数值...],这个需要支持pathinfo,Apache默认支持,而Nginx不支持。
1,修改PHP.INI 支持 PHPINOF
PHP配置文件:/usr/local/php/etc/php.ini
更改php.ini
找到:cgi.fix_pathinfo=0
更改为:cgi.fix_pathinfo=1
2.修改nginx对应配置文件
LNMP上各个版本pathinfo各个版本的设置基本一样:
lnmp v1.1上,修改对应虚拟主机的配置文件
去掉#include pathinfo.conf前面的#,把try_files $uri =404; 前面加上# 注释掉。
1.2, 1.3上,修改对应虚拟主机的配置文件
将include enable-php.conf;替换为include enable-php-pathinfo.conf;
修改pathinfo需要重启nginx生效。
去掉 index.php
1 2 3 4 5 |
|
linux中 /usr/local/nginx/conf/配置文件
windows中
注意: root配置要定位到yyyy的位置,不一定是localhost
1 |
|
3.重启lnmp即可。。
1 |
|
4.设置url_mode =2
1 2 |
|
注:有些文章提到nginx不支持pathinfo,需要在config文件中设置。
我没遇到过! 下面是别人的解决方法,仅供参考。
1 2 3 4 5 6 7 8 9 |
|
还有人是这么配置的:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
推荐学习:《PHP视频教程》
Das obige ist der detaillierte Inhalt vonSo entfernen Sie index.php vom Server. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

Video Face Swap
Tauschen Sie Gesichter in jedem Video mühelos mit unserem völlig kostenlosen KI-Gesichtstausch-Tool aus!

Heißer Artikel

Heiße Werkzeuge

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version
Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6
Visuelle Webentwicklungstools

SublimeText3 Mac-Version
Codebearbeitungssoftware auf Gottesniveau (SublimeText3)
