zoukankan      html  css  js  c++  java
  • 域名访问省略index.php

    [ Apache ]

    httpd.conf配置文件中加载了mod_rewrite.so模块
    AllowOverride None 将None改为 All
    把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下

    RewriteEngine on
     
    RewriteCond $1 !^(index.php|images|robots.txt)
     
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    [ Nginx ]
    在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现:

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

    在location / {  }中添加上这段代码后,重启nginx服务就可以了。

    参考:http://www.thinkphp.cn/topic/63996.html


  • 相关阅读:
    python_day_5:20180720
    python_day_4:20180719
    2018悦读
    2018生活
    心理画
    js 策略模式
    js 单例模式
    js 模板方法模式
    C语言-数据类型
    js 观察者模式
  • 原文地址:https://www.cnblogs.com/wjs2019/p/14548521.html
Copyright © 2011-2022 走看看