php if current url is subdomain name 'media', redirect to main domain
<?php $host = $_SERVER['HTTP_HOST']; // example: dev.example.com $host = explode('.', $host); $host = $host[0]; if($host == 'media'){ header('Location: http://www.example.com', true, 301); exit(); } ?>