0

I really appreciate any answer to my question because I am searching for this about two weeks. My goal is to create directories using PHP and displaying them as a virtual subdomain (All procedure should have done automatically).

For example : example.com/test/index.php should be considered as : test.example.com/index.php

marekful
  • 14,986
  • 6
  • 37
  • 59
Ali
  • 3
  • 2
  • 1
    Isn't that just an apache configuration? From what I know, it doesn't have anything to do with php. – chtenb Feb 23 '13 at 22:06

3 Answers3

1

You cannot do this solely with PHP. You need dynamic shell scripting to create the DNS zone files for each subdomain.

EDIT:

Probably @Robyflc is right, you can base conditions on the host name in PHP. It is not clear form the question if you want the subdomain or just some logic like create a URL user1.domain.com and then find the folder depending on the value of it.

marekful
  • 14,986
  • 6
  • 37
  • 59
1

The only way I was able to do such thing was using a wildcard subdomain. If your server supports that, it's just a matter of using a front controller to manage the requests.

Robyflc
  • 1,209
  • 11
  • 16
0

To do that, I recommand you to buy a VPS server

it's possible with URL Rewriting.

aimadnet
  • 440
  • 4
  • 12