I am working on a site and I am trying to organize where my files are located. I am wondering how I can go from a file in lets say [url]www.example.com/test/test/test.php[/url] to the file located at [url]www.example.com/win.php[/url]. Sorry if this is confusing I am not sure how to explain it. Basically I need a crash course of how to go through multiple folders to change the page.
You'd need to use a .htaccess rewrite.
It'd be something like:
[code]
RewriteBase /
RewriteEngine on
RewriteRule ^test/test/test/test.php test.php [L]
[/code]
Sorry if I couldn't get my point accross clearly, I am trying to find a way to hardcode the directory of a file without using the domain. Here are examples.
I am wanting to use something other than these listed
[php]
header("Location: /test.php");
exit();
[/php]
[php]
header("Location: www.example.com/test.php");
exit();
[/php]
Okay? So wouldn't that accomplish it?
I am not sure how I can go from like server/main/news/index.php to server/login/index.php where server is the webservers main folder.
root directory containing index.html and a test (folder). Inside the test (folder) would be another folder etc. etc.
This would be:
yourwebsite/test/test and so on.
You mean someone like header("Location:../folder/index.php"); ?
A few little things I learned about this, ./ refers to the current directory, ../ refers to a sub-directory, and / refers to root (not too sure on this one though).
[QUOTE=deadeye536;18180114]A few little things I learned about this, ./ refers to the current directory, ../ refers to a sub-directory, and / refers to root (not too sure on this one though).[/QUOTE]
../ refers to the directory above current. / will sometimes return the web root and sometimes the physical servers root. It depends on the setup of the server.
[code]
| index.php
| cake.php
+-+ files
| bob.php
| phill.php
+-+ moar
| troll.html
[/code]
Assuming you are in the file phill.php:
Location: / --- Will take you to "www.example.com/" loading index.php in the root
Location: moar/troll.html --- Will take you to "www.example.com/files/moar/troll.html"
Location: bob.php --- Will take you to "www.example.com/files/bob.php"
Location: /cake.php --- Will take you to "www.example.com/cake.php"
Thanks asherkin this was what I was looking for, thanks also to everyone else who contributed to this thread.
Sorry, you need to Log In to post a reply to this thread.