I'm used to use php -S 0.0.0.0:8080
while developing, because it saves me some time configuring a real web server. Until today I didn't miss anything about it, but now I need to develop a function that uses subdomains.
I must access http://foo-bar.localhost:8080
and make php see the request, because I'm trying to implement this.
Also, foo-bar
is dynamic (like the language
subdomain in the documentation of Yii2 I linked) so I need php to be able to handle all subdomains of localhost
.
Is that possible? How?
The first, i learn english is very bad, sorry if my answer is bad!!
Your problem is test website support subdomain? i think it is relate dns!!
solution for this in here:
For Windows:
Step 1: open C:\windows\system32\drivers\etc\hosts
in text editor with Administrator permission
Step 2: add 127.0.0.1 *.localhost
to new line
Step 3: save hosts file!
Final, the Windows PC already for multi subdomain (ex: foo-bar.localhost:8080)
If you using linux, see the article http://stackoverflow.com/a/20446931
, it same above!
If you cannot using any way, you can use my subdomain!
both local.kingdark.org and *.local.kingdark.org are config for 127.0.0.1, but this way require internet! you can try it for test your website!! (ex: http://foo-bar.local.kingdark.org:8080)
It safe and free!! 8-)
Goodluck!