Im trying to have 2 different sites in one place, first site with wordpress and second one without wordpress, when visitors come from affiliate.webmediamagazine.com to be loaded wordpress, and direct to be loaded another custom index, I’m using the codes below:
http://affiliate.webmediamagazine.com/index.php
<form action='http://www.webmediamagazine.com' method='post' name='frm'>
<input type='hidden' name="affiliate" value="yes">
</form>
<script language="JavaScript">
document.frm.submit();
</script>
http://webmediamagazine.com/index.php
<?php
$affiliate = $_POST['affiliate'];
if ($affiliate == yes) {include 'indexwp.php';}
else {include 'indexcustom.php';}
?>
indexwp.php is wordpress default index.php
indexcustom.php is a simple php script.
This should be configured as Virtual Hosts in your server (Apache? Nginx? …?) config files.
Example for Apache
EDIT:
On a shared hosting, you could put your wordpress files in the
~/www/wordpress/folder for example.Then you make the subdomain (
affiliate.webmediamagazine.com) point to this directory. Most of the time it can be done in the admin panel provided by your host.