Is a masked 307 redirect for a domain possible?

Is a masked 307 redirect for a domain possible? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Is a masked 307 redirect for a domain possible? error on your web browser. Problem :


I've been asked to create a 307 redirect for a domain, ensuring it is "masked". i.e. keep the original URL in the address bar.



There isn't a lot of info available about 307 (as opposed to 301/302) redirects, but from my investigations it seems that 307 redirects are similar to 302 redirects.



I have a feeling what I've been asked to do is impossible, and for now I have created an iframe which loads up his free-hosted-website.



Before I look an idiot and go back to him, and tell him iFrames are the only way to retain the URL in the address bar, can someone confirm this.



Alternatively, tell me how to create a 307 redirect. I assume it's something like this.... But how can it be masked?



Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=307,L]

Solution :

A masked 307 redirect is not possible. You can either redirect or mask but not both together. The code you posted in your question will achieve the redirect if thats the solution you want, but I don't understand why you would want a 307 redirect, which just tells the browser it can't switch between GET/POST method. Best/common practice is to stick to 301 for permanent redirects and 302 for temporary redirects unless this might be used on a URL where POST data is expected. A 307 redirect will not in itself apply any masking - a redirect header whether 301, 302 or 307 will change the browser address.



While most website masking is setup and managed using hosting or domain name control panels rather than people writing source code for it themselves, the method used most today is still the old HTML4 frameset tags which all major browsers still support:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<frameset rows="100%">
<frame src="http://www.masked-domain.com/" />
</frameset>
</html>


To mask by proxying requests you could use PHP code similar to this in index.php:



<?php
$sOldURL = sprintf( 'http://www.masked-domain.com/%s', $_SERVER['REQUEST_URI'] );
echo( @file_get_contents( $sOldURL ));
exit;


and then redirect all requests to that index.php file using a .htaccess file:



RewriteEngine On
RewriteRule ^(.*)$ /index.php/$1 [L]


It's impossible to externally redirect (3xx status) and mask the request (ie. keep the original URL in the address bar). To the end user, a "masked" URL just looks like an ordinary (200 OK) request. A 3xx response is not.




iFrames are the only way to retain the URL in the address bar




However, iframes are not necessarily the only way to mask the URL. Assuming this is a cross-domain request, then the request could be proxied?




...his free-hosted-website.




Well, in this case, an iframe might well be the only way to handle this!






Part of me thinks there must be something else to this? Where are you wanting to "redirect" from?


We hope that this article has helped you resolve the domains, htaccess, redirects error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=