日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > php >内容正文

php

php 去掉url中的index.php,php 去掉url中的index.php

發(fā)布時(shí)間:2023/12/3 php 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php 去掉url中的index.php,php 去掉url中的index.php 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

php去掉url中的index.php的方法:首先打開相應(yīng)的代碼文件;然后將if代碼塊嵌套在server代碼塊中;最后重啟nginx服務(wù)器即可。

本文操作環(huán)境:nginx1.0.4系統(tǒng)、PHP7.1版,DELL G3電腦

nginx服務(wù)器去掉url中的index.php

將if代碼塊嵌套在server代碼塊中, 如下所示:server {

listen 80;

server_name tp6.com www.tp6.com;

root "C:/phpstudy_pro/WWW/tp6/public";

location / {

index index.php index.html error/index.html;

error_page 400 /error/400.html;

error_page 403 /error/403.html;

error_page 404 /error/404.html;

error_page 500 /error/500.html;

error_page 501 /error/501.html;

error_page 502 /error/502.html;

error_page 503 /error/503.html;

error_page 504 /error/504.html;

error_page 505 /error/505.html;

error_page 506 /error/506.html;

error_page 507 /error/507.html;

error_page 509 /error/509.html;

error_page 510 /error/510.html;

include C:/phpstudy_pro/WWW/tp6/public/nginx.htaccess;

autoindex off;

}

if (!-e $request_filename) {

rewrite ^/(.*)$ /index.php?s=$1 last;

}

location ~ \.php(.*)$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

include fastcgi_params;

}

}

完成后,重啟nginx服務(wù)器.

【推薦學(xué)習(xí):PHP視頻教程】

總結(jié)

以上是生活随笔為你收集整理的php 去掉url中的index.php,php 去掉url中的index.php的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。