zoukankan      html  css  js  c++  java
  • 通过htaccess文件配置多个一级域名指向根目录的子文件夹

      创建.htaccess文件,在Windows系统创建时要写成“.htaccess.”,不带双引号,否则不会创建成功。

    <IfModule mod_rewrite.c>
        Options +FollowSymlinks
        RewriteEngine On
        RewriteBase /
     
        #RewriteCond %{REQUEST_FILENAME} !-d
        #RewriteCond %{REQUEST_FILENAME} !-f
        #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
     
        #绑定 localhost 到 public子目录
        RewriteCond %{HTTP_HOST} ^localhost$ [NC]
        RewriteCond %{REQUEST_URI} !^/public/
        RewriteRule ^(.*)$ public/$1?Rewrite [L,QSA]
     
        #绑定 www.abc.com 到 abc子目录
        RewriteCond %{HTTP_HOST} ^www.abc.com$ [NC]
        RewriteCond %{REQUEST_URI} !^/abc/
        RewriteRule ^(.*)$ abc/$1?Rewrite [L,QSA]
     
        #绑定 hello.com 到 hello子目录
        RewriteCond %{HTTP_HOST} ^hello.com$ [NC]
        RewriteCond %{REQUEST_URI} !^/hello/
        RewriteRule ^(.*)$ hello/$1?Rewrite [L,QSA]
     
        #绑定 www.xyz.com 到 xyz子目录
        RewriteCond %{HTTP_HOST} ^www.xyz.com$ [NC]
        RewriteCond %{REQUEST_URI} !^/xyz/
        RewriteRule ^(.*)$ xyz/$1?Rewrite [L,QSA]
    </IfModule>
  • 相关阅读:
    linux固定ip设置
    经典shell面试题
    shell学习笔记
    从tcp到netty(二)
    Mysql复习
    从tcp到netty(一)
    浏览器展示图片(非下载)- java
    异常总结
    反射获取属性值并设置属性值
    TreeMap解析
  • 原文地址:https://www.cnblogs.com/qingsong/p/10353085.html
Copyright © 2011-2022 走看看