zoukankan      html  css  js  c++  java
  • 隐藏index.php

    Apache :

                     #如果mode_rewrite.c模块存在,则执行以下命令
     Options +FollowSymlinks -Multiviews
     RewriteEngine On                           #开启rewriteEngine
     
     RewriteCond %{REQUEST_FILENAME} !-d         #!-d 不是目录或目录不存在
     RewriteCond %{REQUEST_FILENAME} !-f          #! -f 不是文件或文件不存在
     
     #转给index.php处理 #这是最后一个匹配项,不在往下匹配
     RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

    如果使用的 apache 版本使用上面的方式无法正常隐藏 index.php ,可以尝试使用下面的方式配置
    .htaccess 文件:

    Options +FollowSymlinks -Multiviews
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]

    phpstudy :

    Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

    Nginx.conf:

    location / {
    // …..省略部分代码
    if (!-e $request_filename) {
                    rewrite ^(.*)$ /index.php?s=/$1 last;
                    break;
                }
    }

  • 相关阅读:
    前端 HTML
    python3内置函数
    内置函数的随机验证码
    线程、进程以及协程,上下文管理器
    线程池的定义方法
    python_控制台输出带颜色的文字方法
    while 循环 continue break 用法例子
    JVM 基础知识
    ios 设置状态栏文本颜色为白色
    ios 常用第三方库要加的framework,ARC的设置
  • 原文地址:https://www.cnblogs.com/qinsilandiao/p/13432271.html
Copyright © 2011-2022 走看看