Solved

redirect command for php

Posted on 2006-06-13
9
344 Views
Last Modified: 2012-06-27
I am trying to create a page that simply loads a redirect. The page is:

<?
redirect(append_sid("../login.php", true));
?>

I was modeling this after something I had seen in a script I downloaded, but it does not work.

essentially... I want it to redirect to a page called login.php that sits one folder down from the originating file. What code would I use here?

Thanks!
0
Comment
Question by:aumandg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 400 total points
ID: 16899218
aumandg,

Try using the following ...

<?php
   header("location:../login.php");
   exit();
?>

The exit line after is recommended, especially if you want to make sure that the script stops.

b0lsc0tt
0
 
LVL 9

Assisted Solution

by:blue_hunter
blue_hunter earned 100 total points
ID: 16899257
$url = "http://www.experts-exchange.com";
header("Location: ".$url);

a space between Location:   and $url


cheers
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 16899333
@Blue_hunter - Thank you for correcting that mistake.  :-)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:aumandg
ID: 16899522
excellent... thank you. protocol has me giving some points ot b0lsc0tt too? if so, how would you suggest i break it down?
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 16899592
Hi,

C&P from the help files.
 
http://www.experts-exchange.com/help.jsp#hi69 : More than one Expert helped solve my problem. What do I do?

You split the points. Scroll down to the bottom of the question and click the "Split Points" link at the bottom of the page. Select the radio button of the comment who you want to Accept as the answer. Only one button can be selected. Set the point value (a text box above the comment) of how much you want this person to receive of the points. Then set the point values for each of the experts comments to whom you want to allocate points and these will be considered Assisted answers in helping you resolve the issue. Double check your information and then click the Submit button at the bottom of the page. One note: the total points of the splits must equal the amount you asked the question for itself, and no person can receive fewer than 20 points.

This post is not intended to be blunt or as a RTFM type of post. C&P is just easier than writing the text myself.

Kind regards

-r-
 
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 16899597
Give them all to Blue if you wish.  It was a dumb mistake and would not have worked.  I'm glad that I could help a bit.  Thanks for the fun question.

bol
0
 
LVL 9

Expert Comment

by:blue_hunter
ID: 16900131
split the points ;)
0
 

Author Comment

by:aumandg
ID: 16901682
thank you!
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 16904019
Your welcome!  I'm glad that I could help.  Thank you for the grade, the points and the fun question.

bol
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question