Reputation: 351
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.
Upvotes: 0
Views: 104
Reputation: 351
I did it now, using php cookie to store but not from subdomain but only from directory.
Upvotes: 0
Reputation: 8020
If you really mean like this ...when visitors come from..., then just use simple redirect:
<?
switch ( $_SERVER['HTTP_REFERER'] ) {
default:
header( 'Location: /indexcustom.php' ); die;
break;
case 'affiliate.webmediamagazine.com':
header( 'Location: /indexwp.php' ); die;
break;
}
?>
Or use $_SERVER['HTTP_HOST'], if you need to know, what domain
the visitor is in.
But as others already said, in this case it is better to configure it all in apache
level to use different directory with a clean WordPress installation.
EDIT
Are you sure you didn't forget the '
around the word yes in your code?
<?php
$affiliate = $_POST['affiliate'];
if ($affiliate == 'yes') { include 'indexwp.php'; }
else {include 'indexcustom.php';}
?>
Upvotes: 1
Reputation: 5725
This should be configured as Virtual Hosts in your server (Apache? Nginx? ...?) config files.
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.
Upvotes: 1