Want to create dynamic subdomain in codeigniter?

前端 未结 2 1791
生来不讨喜
生来不讨喜 2020-12-09 00:36

In my site i want to add an functionality for user to use their username with domain.

Like in codeigniter right now i want to give the user to use their own url to l

2条回答
  •  生来不讨喜
    2020-12-09 01:07

    here's an explanation of your issue here. http://www.joehayes.org/setting-up-wildcard-dns-for-subdomains.html

    Ok if you have read the explanation on the link, you'd know that you should redirect all of your subdomains to www first. in httpd.conf file there's a virtual host definition containing only yourdomain.com to redirect all the requests to your DocumentRoot.

    **ServerAlias yourdomain.com**
    ServerAdmin webmaster@yourdomain.com
    DocumentRoot /home/yourdoma/public_html
    BytesLog domlogs/yourdomain.com-bytes_log
    ServerName www.yourdomain.com
    User yourdomain
    Group yourdomain
    CustomLog /usr/local/apache/domlogs/yourdomain.com combined
    ScriptAlias /cgi-bin/ /home/yourdomain/public_html/cgi-bin/
    

    and you should modify the ServerAlias to *.yourdomain.com to retrieve all subdomains into your Document Root folder. then you should be able to mod_rewrite or url parse your uri to succeed this.

提交回复
热议问题