PHP Redirects Other than header(location:)

  • Context: PHP 
  • Thread starter Thread starter JamesU
  • Start date Start date
  • Tags Tags
    Php
Click For Summary

Discussion Overview

The discussion revolves around alternative methods for redirecting in PHP beyond the commonly used header(location:) function. Participants explore various approaches, including the use of JavaScript for redirection.

Discussion Character

  • Exploratory, Debate/contested, Technical explanation

Main Points Raised

  • One participant inquires about alternative redirection methods in PHP that can be utilized within a function.
  • Another participant suggests using JavaScript to perform a redirect by writing a script that changes the window location.
  • A participant expresses skepticism about the usefulness of the previous suggestion, indicating that they typically use the two methods mentioned.
  • There is a discussion about the potential for browser warnings when redirecting to a different server, highlighting concerns about user experience.
  • Some participants emphasize the importance of providing help rather than merely directing others to resources like the PHP manual.

Areas of Agreement / Disagreement

Participants express differing views on the adequacy of the responses provided, with some feeling that the suggestions are not sufficiently helpful. There is no consensus on the best alternative method for redirection.

Contextual Notes

Participants do not fully explore the implications of using JavaScript for redirection, such as browser compatibility or user experience issues. The discussion lacks detailed exploration of the limitations or conditions under which each method may be applicable.

JamesU
Gold Member
Messages
828
Reaction score
3
Is there another way to redirect in PHP other than the header(location:) method...? such as one that can be used in a function.
 
Technology news on Phys.org
Download the PHP manual, it has all you need to know.
 
You can use Javascript to redirect using:
Code:
<script>
window.location = '[PLAIN]https://www.physicsforums.com';[/PLAIN] 
</script>
So one alternative is to redirect using PHP to write that on top of a page.
 
Last edited by a moderator:
Big help verty... :rolleyes:


The two listed are the two I use, but I'm not a whiz.
 
Dave, teach a man to fish...
 
verty said:
Dave, teach a man to fish...

This is a help forum. He's come here for help because he didn't find the answer.

With your philosophy, this entire Physics board would be one page: a keyword search of Amazon.com. :-p
 
I'm not that harsh. I knew others would answer. I think in some browsers a window might pop up saying "the page is trying to redirect" if your redirect is to a different server.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 7 ·
Replies
7
Views
7K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 4 ·
Replies
4
Views
7K