Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

302 redirect to non-HTTP protocol

I need to perform a 302 redirect with PHP. I'm trying with header location.

It works well with HTTP. But, the redirect does not work with a custom protocol. For example:

header ('Location: magplus://myaccountview/login/');

How I can fix it?

like image 557
user2423341 Avatar asked Jun 24 '13 00:06

user2423341


People also ask

Is HTTP 302 redirect?

What is an HTTP 302? The 302 status code is a redirection message that occurs when a resource or page you're attempting to load has been temporarily moved to a different location. It's usually caused by the web server and doesn't impact the user experience, as the redirect happens automatically.

How do you resolve a 302 redirect?

You can follow these five steps to fix HTTP 302 errors on your website: Determine whether the redirects are appropriate or not by examining the URLs that are issuing the 302 redirects. Check your plugins to make sure any redirect settings are valid. Ensure that your WordPress URL settings are configured correctly.

What are 302 redirects used for?

A 302 redirect lets search engines know that a website or page has been moved temporarily. When Should You Use 302 Redirects? Use this type of redirect if you want to send users to a new site or page for a short period of time, such as when you're redesigning or updating your website.

What is the difference between 302 and 307 redirect?

302 is temporary redirect, which is generated by the server whereas 307 is internal redirect response generated by the browser.


1 Answers

For some browsers, you will not be able to redirect to a protocol other than HTTP or HTTPS. There is nothing you can do about that specifically.

You can try to change the location in the browser client-side with JavaScript, if that is a possibility for your application. That also won't always work however.

like image 166
Brad Avatar answered Oct 18 '22 13:10

Brad