zoukankan      html  css  js  c++  java
  • 二级域名 apache mod_rewirte

    www.domain.com直接到根目录下

    别的二级域名如
    xyz.domain.com到根目录下的xyz目录。

    实现:
    配置apache的http.conf文件,
    ->取消164行LoadModule rewrite_module modules/mod_rewrite.so前的#号
    ->文件最后
    RewriteEngine on      

    RewriteCond %{HTTP_HOST} ^www\.xieye\.com$      
    RewriteRule ^(.+) /$1 [L]

    RewriteCond %{HTTP_HOST} [^.]+\.xieye\.com$      
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]      
    RewriteRule ([^.]+)\.xieye\.com(.*) /$1$2 

    20070704再度修改

    # 配置 Apache重定向模块 用于二级域名解析 xieye 20080704
    RewriteEngine on      


    # 主站,url是www.xieye.com
    RewriteCond %{HTTP_HOST} ^www\.xieye\.com$      
    RewriteRule ^(.+) /$1 [L]

    # 专业子站 url是gongsi.xieye.com/
    # 专业子站,进入 例如 specialty/gongsi/ 这样的子目录,但是,如果是找js,css,upload等,则再度返回主站目录
    RewriteCond %{HTTP_HOST} ^(gongsi|fangdichan|haishang|hunyin|jianshe|jingji|jingrong|laodong|shewai|sunhai)\.xieye\.com$      
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]      
    RewriteRule ([^.]+)\.xieye\.com(.*) /specialty/$1$2  [C]
    RewriteRule  /specialty/[^/]+/(ajax|cp|css|fckeditor|images|js|upload)/(.+) /$1/$2 [L] 

    # 地区分站 url是nanjinglaw.xieye.com/
    # 地区分站,进入 例如 area/nanjing/ 这样的子目录,但是,如果是找js,css,upload等,则再度返回主站目录
    RewriteCond %{HTTP_HOST} ^([^.]+)law\.xieye\.com$      
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]      
    RewriteRule ([^.]+)law\.xieye\.com(.*) /area/$1$2 [C] 
    RewriteRule  /area/[^/]+/(ajax|cp|css|fckeditor|images|js|upload)/(.+) /$1/$2 [L] 

    # 博客  url是zhangsan.xieye.com/
    # 博客,进入 例如 blog/z/h/angsan/ 这样的子目录,但是,如果是找js,css,upload等,则再度返回主站目录
    RewriteCond %{HTTP_HOST} [^.]+\.xieye\.com$      
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]      
    RewriteRule (a-z0-9)(a-z0-9)([^.]+)\.xieye\.com(.*) /blog/$1/$2/$3$4 
    RewriteRule  /blog/[^/]+/[^/]+/[^/]+/(ajax|cp|css|fckeditor|images|js|upload)/(.+) /$1/$2 [L] 

    摘自:http://xieye.iteye.com/blog/199619

  • 相关阅读:
    What is the purpose of FormsAuthenticationTicket isPersistent property?
    Forms Authentication configurations
    What is the difference between localStorage, sessionStorage, session and cookies?
    Set-Cookie
    申威机器信息
    systemctl 关闭图形界面的办法
    sourcetree 使用
    在 Web 项目中应用 Apache Shiro
    移动web开发框架
    从0开始搭建symphony
  • 原文地址:https://www.cnblogs.com/chenqianpeng/p/2509521.html
Copyright © 2011-2022 走看看