English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i moved all my webpage file from the root to a subroot. offcoruse when somone tries to access my page it wont load up. so i need to create a index.html file on the root to direct to the subroot. what code do i need? i know it cant be more then a line.
Thanks,

2006-12-08 09:35:15 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

pls try to suggets php code

2006-12-08 09:37:26 · update #1

thanks guys
NEXUS is the man

2006-12-08 09:52:55 · update #2

thanks dvhrm
both 1st and 3rd codes work
but teh links on my page wont work!!! when i forward the page..!

2006-12-08 10:04:36 · update #3

4 answers

Meta Tag Redirect:









"../" = 1 previous folder, "../../" goes back two:

http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm

2006-12-08 09:38:12 · answer #1 · answered by Anonymous · 1 0

Your php file would be named index.php and contain ONLY this text:

header('Location: path/index.html');
?>

Where path/index.html is the relative address to the new subroot.

For example, if the url to your subroot is:

http://www.mydomain.com/ subroot/index.html

Then you would have:

header('Location: subroot/index.html');
?>

UPDATE

When you moved your files, you didn't correct the paths in your links. Chances are, if you look at the links, you'll see things like:

Link

or

Another Link

The /index.html tells the browser, "Look in the root directory, then find the file index.html." The /folder/index.html tells the browser, "look in the root directory for a directory named folder. Then, in that, find index.html."

That's called linking relative to root.

If you get rid of the leading /, you will return your files to linking relative to the document. For example:

Third Link

tells the browser, "whereever you found this page, look for a directory named folder. Then, in that, find index.html."

2006-12-08 09:54:39 · answer #2 · answered by Anonymous · 0 0

if you are on apache, and htaccess file is all you need.

open a text document, put the following line into it:

Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html

and save as .htaccess (notice the period before htaccess) upload to your root directory.

Word of note, if you put files above your root directory, then no coding will work. All your files must reside below your root

2006-12-08 09:49:23 · answer #3 · answered by arus.geo 7 · 1 0

windows is your problem, get a real OS, preferably something debian based

2016-05-23 07:35:12 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers