.htaccess rewrite subdomain to directory

前端 未结 8 1989
不思量自难忘°
不思量自难忘° 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:06

    Try to putting this .htaccess file on subdomain folder:

    RewriteEngine On
    
    RewriteRule ^(.*)?$ ./subdomains/sub/$1
    

    It redirects to http://domain.com/subdomains/sub/, when you only want it to show http://sub.domain.com/

提交回复
热议问题