Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP Header location back to root

Posted on 2011-10-09
4
Medium Priority
?
392 Views
Last Modified: 2012-05-12
Hello Experts,

I have tried to get my header to go back to root by loads of different ways but cant do it...

my script lies in : /actions/login.php

and on success i need it to go to : /home.php

Any ideas?
0
Comment
Question by:maccaj51
4 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 2000 total points
ID: 36938397
try
header("Location: ../home.php");
0
 
LVL 7

Expert Comment

by:amigura
ID: 36938512
As Roads_Roads says add two dots or full url to page
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 36938520
Try an absolute address

header( "Location: http://" . strip_tags( $_SERVER ['HTTP_HOST'] ) . "/home.php" );
exit;

Open in new window


DO NOT FORGET THE exit

If $_SERVER['HTTP_HOST'] returns a trailing slash (depending on your setup) then modify the above to be

header( "Location: http://" . strip_tags( $_SERVER ['HTTP_HOST'] ) . "home.php" );
exit;

Open in new window




0
 

Author Closing Comment

by:maccaj51
ID: 36938598
Many Thanks to All!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

578 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