How to create a subdomain with username as subdomain name?

前端 未结 3 432
别那么骄傲
别那么骄傲 2020-12-24 09:54

I have referred other related question but they are not clear to me. Please explain me: How can I make subdomain in PHP?

Example :

http://www.domainn         


        
3条回答
  •  渐次进展
    2020-12-24 10:45

    You may create a virtual sub domains and then you can redirect it with .htaccess.

    You also have to create

    A Record look like this

    *.exmple.com A 127.0.0.1 or your IP

    in your DNS.

    Then add something like this in your .htaccess

    RewriteRule ^([aA-zZ])$ home.php?username=$1

    RewriteCond %{HTTP_HOST} ^(^.).mywebsite.com
    RewriteRule (.
    ) home.php?username=%1

    It should help

提交回复
热议问题