zoukankan      html  css  js  c++  java
  • Apache 添加自定义vhost 目录,等其他配置

    Apache 添加自定义vhost 目录,等其他配置

    1、在 Apache 下找到 httpd.conf  ,这个文件中找到默认 Include conf/vhosts.conf   ,

    在这个之后添加 Include conf/self_vhosts/*.conf

    我的配置: 
    
    Include conf/vhosts.conf
    Include conf/self_vhosts/*.conf

     2、 Apache 添加 404 跳转到首页 在 vhost 文件中添加如下

    主要代码:  ErrorDocument 404 http://www.test.com

    <VirtualHost *:80>
        DocumentRoot "E:/web/bj_tour_en/A206/"
        ServerName www.test.com
        ErrorDocument 404 http://www.test.com
    </VirtualHost>

    2-02 、 强制 Apache 返回一个404状态码 (其他http状态码)

    Redirect 404 /          #访问根目录显示404
    Redirect 500 /          #访问根目录显示500
    <Directory /data/www>
        Deny from all   #403 拒绝访问
        #ErrorDocument 404 /test/404.html  #404 重定向
        #ErrorDocument 404 "This is 404 page"  #400 显示错误字符串
    </Directory>

    官网: Apache HTTP 服务器 2.4 文档

  • 相关阅读:
    Win10安装组策略功能
    IIS 站点批量迁移
    MongoDB 异常记录
    微信Web开发者工具
    NHibernate 异常
    Git 常用命令
    IIS 反向代理
    CSS应用
    Oracle
    Android之ActionBar学习
  • 原文地址:https://www.cnblogs.com/dafei4/p/12939135.html
Copyright © 2011-2022 走看看