网站的访问url可能是这样
http://www.xxx.com/index.php/home/index/index

这种有点不美观,我们想达到如下效果
http://www.xxx.com/home/index/index

修改一下nginx配置即可:

server {
  listen 80;
  server_name www.xxx.com;
  root "/var/html/wwwroot/xxx";
  index index.html index.php;
  location / {
    if (!-e $request_filename){
      rewrite ^(.*)$ /index.php?s=$1 last;
      break;
    }

  }
  # ...
}

nginx隐藏入口文件index.php的更多相关文章

  1. CI 框架怎么去掉隐藏入口文件 index.php

    当我重新接触一个框架的时候首先肯定要去掉入口文件,也就是index.php 这个东西在url上很不漂亮,而且每次我访问我的网站的时候都要打进去url里面.这样告诉一个去掉 CI框架里面入口文件的方法, ...

  2. ThinkPHP5.X PHP5.6.27-nts + Apache 通过 URL 重写来隐藏入口文件 index.php

    我们先来看看官方手册给出关于「URL 重写」的参考: 可以通过 URL 重写隐藏应用的入口文件 index.php ,Apache 的配置参考: 1.http.conf 配置文件加载 mod_rewr ...

  3. Nginx配置 隐藏入口文件index.php

    Nginx配置文件里放入这段代码 server { location / { index index.php index.html index.htm l.php; autoindex on; if ...

  4. Nginx如何来配置隐藏入口文件index.php(代码)

    Nginx配置文件里放入这段代码 server { location / { index index.php index.html index.htm l.php; autoindex on; if ...

  5. Apache 隐藏入口文件 index.php

    新建 .htaccess文件至站点目录下,并写入如下代码: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQ ...

  6. 【apache】phpstudy中apache 隐藏入口文件index.php (解决no input file specified错误)

    步骤: 下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 例如: 你原来的路径是: localhost/index.php/Index/index改变后的路径是: loca ...

  7. CI隐藏入口文件index.php

    1.需要apache打开rewrite_module,然后修改httpd.conf的AllowOverride none 为AllowOverride All(里面,不同的环境目录不同) 2.在CI的 ...

  8. TP5 隐藏入口文件 index.php

    找到public下的.htaccess <IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine ...

  9. niginx隐藏入口文件index.php

    location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$ last; break; } }

随机推荐

  1. QT编程环境

    (1)QT的工具 ① assistant 帮助手册 ② qmake -v 查看qt版本 ③ qmake -project 可以把项目的源文件组织成项目的描述文件 .pro ④ qmake 可以根据.p ...

  2. 基于虹软的Android的人脸识别SDK使用测试

    现在有很多人脸识别的技术我们可以拿来使用:但是个人认为还是离线端的SDK比较实用:所以个人一直在搜集人脸识别的SDK:原来使用开源的OpenCV:最近有个好友推荐虹软的ArcFace, 闲来无事就下来 ...

  3. html缓存控制

  4. Hadoop经典案例(排序&Join&topk&小文件合并)

    ①自定义按某列排序,二次排序 writablecomparable中的compareto方法 ②topk a利用treemap,缺点:map中的key不允许重复:https://blog.csdn.n ...

  5. 微信小程序textarea组件在fixed定位中随页面滚动

    如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true https://developers.weixin.qq.com/miniprogr ...

  6. css预处理器--sass学习($变量名)

    sass有两种形式1.scss  2.sass 一:代码的基本用法 1.变量 如果变量需要镶嵌在字符串之中,就必须需要写在#{}之中. $side : left; .rounded { border- ...

  7. [Codeforces441E]Valera and Number

    Problem 给定一个数x,有p%的概率乘2,有1-p%的概率加1,问操作k次,其二进制数下末尾零的个数的期望. Solution 每次操作只会影响到最后的8位 我们用dp[i][j]表示i个操作后 ...

  8. or 的判断

    NeedCompact := NeedCompact or (AdoQ.ExecSQL > 0)

  9. websocket随笔

    https://github.com/littlechaser/push-service 我们在浏览器调服务器的时候使用http连接通常就能实现,但是如果要服务器数据发生变化,需要主动推送给客户端(如 ...

  10. linux 基础测试题

    1. 什么是buffer和cache buffer (cpu→内存→磁盘,简称为写缓冲 ):当你网上观看视频且网络波动较大的时候,会发现弹出一个正在缓冲中,这个就是buffer. cache(磁盘→内 ...