monkeytooth Posted April 14, 2008 Share Posted April 14, 2008 Ok, I am lost.. I have several forwarded domains to a single domain/page. Some of these domains I am selling, some of these domains I have plans for, and some of them I just don't know any more. Anyway. I'm trying to keep track of which ones getting hits and when. As well as I want to just simply put one of a few particular messages on the loading page pending the domain thats being used. IE for sale, coming soon, whatever. So my idea is (maybe theres a better way) is to use something like: $_SERVER['HTTP_HOST'] to identify the domain.. However since most of the domains are forwarded. I get the underlying domain that they are forwarded to with the above snipplet.. Anyone know of a way to work around that? Or anyone got any suggestions for a means of doing what I want without having to forward every domain to a separate page, or without having to just host them standalone to do what I want. The domains are reg'd with godaddy.. some have the "Masked" option to keep the domain showing, some don't mostly cause I have been trying diffrent things to get the above to work. But over all for my own ease I just want one master page for everything, and from said master page I want to do what I want to do with it per domain. So to be a broken record Im open to suggestions :-) Thanks Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/ Share on other sites More sharing options...
doni49 Posted April 14, 2008 Share Posted April 14, 2008 Set up a re-write rule on your server so that mydomain.com/origdomain/originaldomain.com would become mydomain.com/redirected.php?origdomain=originaldomain.com Then in your GD account, forward the domain (go ahead and leave the masking on) to mydomain.com/origdomain/originaldomain.com Last but not least redirected.php would look like this: $myDomain = $_GET['origdomain']; echo $myDomain; This is all theory. But it SHOULD work. I don't know what will happen if/when the visitor types in a request for a specific page--maybe that could be dealt with via the re-write rule. Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-517131 Share on other sites More sharing options...
monkeytooth Posted April 14, 2008 Author Share Posted April 14, 2008 Unfortunately that didnt work. Thanks for the post though.. I guess the best thing would be to say is goto http://www.yejy.com notice how it forwards to http://www.futurewebspace.com (unmasked)... I may end up masking them again, but over all masked or unmasked they still don't show the domain. In this example it wont show yejy.com it will show futurewebspace.com even when masked. The domains are all reg'd with godaddy if that helps any.. So yea to reiterate if someone goes to yejy.com it forwards to futurewebspace.com where on futurewebspace.com I am intent on having a small simple script that hopeful can tell that if someone went to the domain yejy.com or one of the other forwarded domains that point to the same place. and If its anything other then futurewebspace.com echo the domains name, then echo out a message of.. for sale, parked, dead, alive, coming soon.. what ever... any ideas? Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-517210 Share on other sites More sharing options...
doni49 Posted April 15, 2008 Share Posted April 15, 2008 What page did you tell GD to forward to? Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-517218 Share on other sites More sharing options...
monkeytooth Posted April 15, 2008 Author Share Posted April 15, 2008 No page in specific.. just went the default route.. index.php (which is where I am tempting to work the script into) Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-517286 Share on other sites More sharing options...
doni49 Posted April 15, 2008 Share Posted April 15, 2008 No page in specific.. just went the default route.. index.php (which is where I am tempting to work the script into) That doesn't sound like you tried what I suggested and I really do think it would work. I use GD too. I used to use their forwarding system as well--with the mask. I was able to forward it to www.ISPDomain.com/~username/anyfolderIWant. I'm suggesting that you forward the yejy.com domain to http://www.futurewebspace.com/origdomain/yejy.com. Then on your server (I'm assuming that since you can use PHP, you have your own server or can at least use MOD_rewrite) create a rewrite rule that will redirect http://www.futurewebspace.com/origdomain/yejy.com to http://www.futurewebspace.com/redirected.php?origdomain=yejy.com. Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-517295 Share on other sites More sharing options...
monkeytooth Posted April 15, 2008 Author Share Posted April 15, 2008 Tried, and didn't work... $myDomain = $_GET['origdomain']; echo $myDomain; however the mod_rewrite i do belive is a possibility, however im not to familiar with htaccess.. and the uses there about for it. do you have an example of what you mean? or a resource to point me to that can help me with this more specificly? Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-517977 Share on other sites More sharing options...
doni49 Posted April 16, 2008 Share Posted April 16, 2008 Put the following in your .htaccess file (on the server that's you're redirecting TO)--this file should be in the root folder of your web site. RewriteEngine on Rewriterule ^origdomain/([A-Za-z0-9]+)/[A-Za-z0-9//]+$ redirected.php?originaldomain=$1 Rewriterule ^origdomain/([A-Za-z0-9]+)$ redirected.php?originaldomain=$1 Using the above, if someone visits futurewebspace.com/origdomain/yejy.com, they will see THAT URL in the browser--but the server will act as though they visited futurewebspace.com/redirected.php?orignaldomain=yejy.com. That means that if you have the following in the redirected.php file, it will display yejy.com: $myDomain = $_GET['origdomain']; echo $myDomain; Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-518091 Share on other sites More sharing options...
monkeytooth Posted April 16, 2008 Author Share Posted April 16, 2008 You think that would work if i Masked the domain so that when forwarded, it will show yejy.com.. but coincide with what you just said above? Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-518131 Share on other sites More sharing options...
doni49 Posted April 16, 2008 Share Posted April 16, 2008 Yes I do. All that GD knows is that it's supposed to send all traffic this one url. The server should see the request for that URL and process it the same as if you visited that page manually. But like I originally said, this is all theory. BUT I really think it'll work. Link to comment https://forums.phpfreaks.com/topic/101097-php-and-forwarded-domains/#findComment-518135 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.