-1

I am new in PHP I am trying to create a subfolder to subdomain.

For example:

http://demo.com/subfolder

           to 

http://subfolder.demo.com

any one help to create this function in php.

smith
  • 1
  • Please check : http://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php – HeeMZa Apr 20 '17 at 08:22
  • 2
    Possible duplicate of [Create subdomains on the fly with .htaccess (PHP)](http://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php) – Cong Ma Apr 20 '17 at 12:01

2 Answers2

0

Create a subfolder in www folder and then create a sub domain using cpanel and set root path to created folder. I don't think there is any role of function.php.

Davinder Kumar
  • 652
  • 4
  • 17
0

That's not done through PHP itself. You'd have to configure that on in your hosting panel where the application is hosted.

Try Googling for the hostingpanel you're using (might be something like DirectAdmin or cPanel). There are loads of guides on how to setup subdomains.

Also don't forget to change the DNS. Not all DNS-servers automatically tunnel through subdomains.

Best of luck!

Thoby
  • 316
  • 1
  • 6
  • You cannot configure that in PHP. That has to do with actually routing *to* your application. PHP cannot influence that area. If you want to link to the subdomain, something like `header('location: http://subfolder.demo.com/');` would work. But that does not seem to be your question. – Thoby Apr 20 '17 at 08:05