• PHPStudy+PHPStorm下配置隐藏项目入口文件


            默认情况下项目入口文件是站点根目录下index.php文件,一般程序启动时通过这个文件,定义文件路径,配置重要节点(比如是否开启调试模式),注册路由等,不管是为了伪静态还是为了url的美观,经常需要隐藏掉入口文件: 

            

            在apache服务模式下,是在项目根目录下,添加.htaccess并添加如下代码: 

     1 <IfModule mod_rewrite.c>
     2 Options +FollowSymlinks
     3 RewriteEngine on
     4 RewriteBase /
     5 
     6 RewriteCond %{REQUEST_FILENAME} !-d
     7 RewriteCond %{REQUEST_FILENAME} !-f
     8 RewriteCond $1 !^(Uploads)
     9 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    10 </IfModule>

            

                         nginx服务模式下,更改nginx-conf文件中的Server->location配置节:                    

     1 server {
     2         listen       80;
     3         server_name  localhost;
     4 
     5         #charset koi8-r;
     6 
     7         #access_log  logs/host.access.log  main;
     8         root    "D:/SofrInstall/phpStudy/PHPTutorial/WWW/Practice/";
     9         #location / {
    10         #    index  index.html index.htm index.php l.php;
    11         #   autoindex  off;
    12         #}
    13         location / {
    14     if (!-e $request_filename){
    15         rewrite ^/index.html/?$ /index.php?s= last;
    16         rewrite  ^(.*)$  /index.php?s=$1 last;
    17         break;
    18     }
    19 }

            配置完成之后,保存文件重启服务生效:

                        

            参考地址:https://www.shiqidu.com/p/80

  • 相关阅读:
    小技巧
    sql日期函数
    c#发送邮件
    js点滴
    Js序列化时间
    js中string的操作
    原系统中有AD FS , CRM Server ,迁移ADFS 到另一台电脑 , CRM Server用443端口出错
    解决UR 12后ISV目录不能用的问题
    Lucene .Net 版本
    Android 开源项目
  • 原文地址:https://www.cnblogs.com/andayhou/p/8276975.html
Copyright © 2020-2023  润新知