CSS
-Tricks
treehouse :
what would you like to learn today?
Web Design
Web Development
iOS Development
Show search box
Search
Search in:
All
Articles
Forums
Snippets
Videos
✕
Home
Forums
Snippets
Gallery
Videos
Almanac
Demos
Lodge
Navigation 'n' Search
Forums
Illustration by Nick Sirotich
Forums
»
PHP Problems
PHP Header
mdgrech
Permalink to comment
#
March 2009
What I have:
header('Location: index.php');
Where its taking me:
http://localhost/sm/system/forms/index.php
results in a page not found cause index php is located at
http://localhost/sm
So I'm looking for something like header('Location: ../index.php') to get back to the main directory. Any ideas?
TheDoc
Permalink to comment
#
March 2009
Does ../index.php not work?
mdgrech
Permalink to comment
#
March 2009
Nope, does make it any difference at all...its still looking in
http://localhost/sm/system/index.php
mdgrech
Permalink to comment
#
March 2009
Figured it out...I needed one more ../ so I ended up with:
header('Location: ../../index.php');
so use one ../ for each directory you want to go back. I could of sworn you only needed one ../ to get back to the main dir, guess not.
Add a Comment
header('Location: index.php');
Where its taking me:
http://localhost/sm/system/forms/index.php
results in a page not found cause index php is located at http://localhost/sm
So I'm looking for something like header('Location: ../index.php') to get back to the main directory. Any ideas?
header('Location: ../../index.php');
so use one ../ for each directory you want to go back. I could of sworn you only needed one ../ to get back to the main dir, guess not.