【问题标题】:.htaccess subdomain wildcard.htaccess 子域通配符
【发布时间】:2011-08-16 07:00:34
【问题描述】:

我一直在寻找在我的 .htaccess 中执行 mod_rewrite 的许多不同方法,以创建转发到特定路径的通配符子域,同时保留目录和页面的尾随 url。似乎没有什么能解决问题。我只是不太擅长正则表达式,还没有弄清楚。

我的通配符需要制作:

http://username.domain.org/project1/hello.html

同:

http://domain.org/domains/username/project1/hello.html

有什么想法吗?

【问题讨论】:

    标签: .htaccess mod-rewrite subdomain


    【解决方案1】:

    在你的 .htaccess 文件中试试这个:

    Options +FollowSymlinks -MultiViews
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.org$ [NC]
    RewriteRule ^(.*)$ http://domain.org/%1/$1 [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-06
      • 2011-06-05
      • 2012-01-23
      • 1970-01-01
      • 1970-01-01
      • 2018-08-14
      • 2014-04-01
      • 1970-01-01
      相关资源
      最近更新 更多