zoukankan      html  css  js  c++  java
  • CI路径中如何去掉index.php

    apache去掉index.php

    1.编辑conf/httpd.conf配置文件

      #LoadModule rewrite_module modules/mod_rewrite.so 把该行前的#去掉

      同时对应Directory下要配置 AllowOverride All

    2.在 CI 根目录下(即在index.php,system的同级目录下)新建立一个配置文件,命名为: .htaccess 内容如下:

      RewriteEngine On

      RewriteCond %{REQUEST_FILENAME} !-f

      RewriteCond %{REQUEST_FILENAME} !-d

      RewriteCond $1 !^(index.php|robots.txt)

      RewriteRule ^(.*)$ index.php/$1

      RewriteCond %{REQUEST_FILENAME} !-f

      RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]

    3.把system/application/config/config.php 中$config['index_page'] = "index.php";改为$config['index_page'] = ""; 

    4.重启apache

    nginx去掉index.php

    1.编辑nginx.conf文件

      vi /usr/local/xxxxx/nginx/conf/nginx.conf

      #nginx去掉index.php

          location / {

             rewrite ^/$ /index.php last;

             #防止某些文件夹被直接访问

             rewrite ^/(?!index.php|robots.txt|uploadedImages|resource|images|js|css|styles|static)(.*)$ /index.php/$1 last;

          }

    2.config/config.php下配置$config['index_page'] = '';

    3..重启nginx

  • 相关阅读:
    BZOJ 1051: [HAOI2006]受欢迎的牛( tarjan )
    BZOJ 2208: [Jsoi2010]连通数( DFS )
    js效果-鼠标提示框
    CSS-背景
    CSS-文本
    tomcat 安装 for Mac
    CSS选择器基础
    POJ3349-Snowflake Snow Snowflakes-Hash
    数据库的三大设计范式
    HDU5120-Intersection-两个圆环相交面积
  • 原文地址:https://www.cnblogs.com/antik/p/3990677.html
Copyright © 2011-2022 走看看