zoukankan      html  css  js  c++  java
  • linux服务器中Apache隐藏index.php失败

    可以通过URL重写隐藏应用的入口文件index.php,下面是相关服务器的配置参考:

    【Apache】

    1. httpd.conf配置文件中加载了mod_rewrite.so模块
    2. AllowOverride None 将None改为 All (PS:所有的AllowOverride对应的None都改为ALL)
    3. 把下面的内容保存为.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>

    以上操作全部都完成,重启apache后还是失败,原因在与include的【httpd-vhosts.conf】中配置没有改成允许URL重写。

    只需将

    DocumentRoot "F:/wamp/www/test"
    
    ServerName www.test.com
    
    ServerAlias admin.tpshop.com
    
    DirectoryIndex index.html index.htm index.php
    
    Options FollowSymLinks
    
    AllowOverride none
    
    Order allow,deny
    
    Allow from all

    改成

    DocumentRoot "F:/wamp/www/test"
    
    ServerName www.test.com
    
    ServerAlias admin.tpshop.com
    
    DirectoryIndex index.html index.htm index.php
    
    Options FollowSymLinks
    
    AllowOverride All
    
    Order allow,deny
    
    Allow from all

    然后保存,重启apache就可以了。

  • 相关阅读:
    SQL Server 性能优化之RML Utilities:快速入门(Quick Start)(1)
    sp_rename sqlserver 表 列 索引 类型重命名
    T- SQL性能优化详解
    sql-索引的作用(超详细)
    用一条SQL语句取出第 m 条到第 n 条记录的方法
    SARG
    git
    ssh
    70小事
    websocket
  • 原文地址:https://www.cnblogs.com/crystaltu/p/7121826.html
Copyright © 2011-2022 走看看