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

    原文——>链接

    官方默认的.htaccess文件

    <IfModule mod_rewrite.c>
      Options +FollowSymlinks -Multiviews
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    </IfModule>

    如果用phpstudy,规则如下:

    1、确认你的apache开启rewrite模块、

    2、修改官方文件最后一行 (PHP5.5+)

    RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

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

    1、确认你的apache开启rewrite模块、

    2、修改官方文件最后一行,在/$1前边加一个 ? (注意英文格式半角)

    RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]

    如果是Nginx环境,可以在Nginx.conf中添加:

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

    1

  • 相关阅读:
    活动安排问题
    完美字符串
    Codeforces Round #696 (Div. 2) 解题报告
    Codeforces 1459D
    Codeforces 25D
    POJ 1847
    LightOJ 1074
    POJ 3159
    POJ 1511
    POJ 1502
  • 原文地址:https://www.cnblogs.com/Skate0rDie/p/11109594.html
Copyright © 2011-2022 走看看