Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Getting the domain name of a 301 redirected URL with masking

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Getting the domain name of a 301 redirected URL with masking

Postby BenRacicot » Mon Jan 27, 2014 8:36 am

Hello there PHP guys,

I opened a StackOverflow question -> http://stackoverflow.com/questions/2135 ... d-with-php because I am stumped! I'm redirecting several .com's (301's with masking) to one main domain with a landing page installed. However in order to grab the current domain I've been using
Code: Select all
<?php echo parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); ?>


This however does not work in other browsers (FF, I can only imagine IE wouldn't either) because - from the php manual, "This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature.

Side note: These are domains from Godaddy being 301 redirected with masking enabled. When viewed in FF I get a random domain name displayed with
Code: Select all
<?php echo parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); ?>
This is something I cannot explain at all and have opened a ticket for Godaddy.

Any ideas to make this work with PHP on all browsers will be amazing! Thank you.
BenRacicot
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jan 27, 2014 8:24 am

Re: Getting the domain name of a 301 redirected URL with mas

Postby BenRacicot » Mon Feb 03, 2014 3:28 pm

It turns out that this is not possible because 301 redirecting with masking uses frames to display your actual website content. I got this to work by pointing my domains at the same server, then parking them on my target domain.
BenRacicot
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jan 27, 2014 8:24 am

Re: Getting the domain name of a 301 redirected URL with mas

Postby mfollett » Wed Feb 05, 2014 6:19 am

I appreciate that this is a PHP forum, but what you're trying to achieve is possible with JavaScript.
mfollett
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Feb 05, 2014 3:48 am


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.