NameSilo

Wildcard subdomain

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

armstrong

Man from ManilaVIP Member
Impact
53
I defined a wildcard host record ( *.mydomain.com ) in enom, so if anyone types gibberish.mydomain.com then it still ends up at mydomain.com . Is there any way to capture which particular gibberish was used, perhaps through an environment variable? Can I, for example, capture this in php, and display something like:

"You entered gibberish.mydomain.com"

Thanks!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
The domain name is passed in the $_SERVER['HTTP_HOST']; (or $HTTP_HOST) variable in PHP.

If you visited http://gibberish.mydomain.com, $HTTP_HOST would equal 'gibberish.mydomain.com'

You could use a function like this to extract the first part,
PHP:
  $dots = explode('.', $HTTP_SERVER_VARS["HTTP_HOST"]); 
  unset($dots[count($dots) - 1]); 
  unset($dots[count($dots) - 1]); 
$subdomain= implode('.', $dots);
there are other ways to do the same with PHP string functions.
 
0
Close
0
Close
All this talk about the pro.ph project is getting me excited to see how it all comes together! So does php code like "explode" and "implode", but not nearly as much so... :) I can't wait for pro.ph to launch! :)
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back