.htaccess rewrite subdomain to directory

前端 未结 8 2044
不思量自难忘°
不思量自难忘° 2020-11-22 10:26

Is it possible to use .htaccess to rewrite a sub domain to a directory?

Example:

  • http://sub.domain.com/

shows the content of

8条回答
  •  误落风尘
    2020-11-22 11:11

    Redirect subdomain directory:

    RewriteCond %{HTTP_HOST} ^([^.]+)\.(archive\.example\.com)$ [NC]
    RewriteRule ^ http://%2/%1%{REQUEST_URI} [L,R=301]
    

提交回复
热议问题