Board logo

标题: 如何在apache中隐藏index.php [打印本页]

作者: xiexie    时间: 2023-6-15 11:54     标题: 如何在apache中隐藏index.php

apache如何隐藏index.php :
首先检测apache是否支持" mod_rewrite " 然后打开“mod_rewrite;
然后找到" AllowOverride None "将None更改为All;
 <Directory "d:/AppServ/***">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
最后修改htaccess文件就可以了。
RewriteEngine on
RewriteCond $1 !^(index\.php|backup)
RewriteRule ^(.*)$ index.php?/$1 [L]





欢迎光临 PHP开发笔记 (http://phpvi.com/) Powered by Discuz! 6.1.0