By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,719 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,719 IT Pros & Developers. It's quick & easy.

the root folder

P: n/a
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of
the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call the
root folder.
Any help please?
Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:DE********************@news20.bellglobal.com. ..
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of
the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call the root folder.
Any help please?


Are you trying to include the file or create a link to it? That is quite
unclear.

- Virgil
Jul 17 '05 #2

P: n/a
Thanks.

I like to call the file:

<body onload="document.location.href='../../index.html';">

"Virgil Green" <vj*@obsydian.com> wrote in message
news:QS*******************@newssvr22.news.prodigy. com...
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:DE********************@news20.bellglobal.com. ..
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call

the
root folder.
Any help please?


Are you trying to include the file or create a link to it? That is quite
unclear.

- Virgil

Jul 17 '05 #3

P: n/a
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:DE********************@news20.bellglobal.com. ..
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of
the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call the root folder.


If you want sub1/index.php and other subN/index.php to redirect to root, use
header function.

<?php
header("Location: http://mysite.com/index.html"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>
Jul 17 '05 #4

P: n/a
Thanks.
I don't like to use http://mysite in my call, because I can install my
solution in differant location,
http://mysite1
http://mysite2......

And I like that the code works in all situations

Thanks.

"Pertti Kosunen" <pe************@kolumb.us.fi_invalid> wrote in message
news:c6**********@phys-news1.kolumbus.fi...
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:DE********************@news20.bellglobal.com. ..
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call the
root folder.


If you want sub1/index.php and other subN/index.php to redirect to root,

use header function.

<?php
header("Location: http://mysite.com/index.html"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

Jul 17 '05 #5

P: n/a
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:8_********************@news20.bellglobal.com. ..
Thanks.

I like to call the file:

<body onload="document.location.href='../../index.html';">


You can always access the root index.html just by using "/index.html".

- Virgil
Jul 17 '05 #6

P: n/a
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:l3********************@news20.bellglobal.com. ..
Thanks.
I don't like to use http://mysite in my call, because I can install my
solution in differant location,
http://mysite1
http://mysite2......

And I like that the code works in all situations


http://fi2.php.net/manual/en/function.header.php

You can use $_SERVER['HTTP_HOST'].

<?php
header("Location: http://" . $_SERVER['HTTP_HOST'] . "/");
?>
Jul 17 '05 #7

P: n/a
In article <l3********************@news20.bellglobal.com>,
"toufik toufik" <to*****@sympatico.ca> wrote:
Thanks.
I don't like to use http://mysite in my call, because I can install my
solution in differant location,
http://mysite1
http://mysite2......

And I like that the code works in all situations

Thanks.


Then you can do this:

header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.html');

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #8

P: n/a
toufik toufik schrieb:
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of
the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call the
root folder.


You could do a redirect:

$domain=$_SERVER['HTTP_HOST'];
header("Location: http://$domain/index.html");

Or simply include it with this index.php:

<?php include('/index.html'); ?>

The second solution creates a problem with files included by the
index.html, because all the relative paths have changed. Any pictures or
JavaScripts have to be referenced by absolute URL. If this is OK for
you, use the include, because it should be a bit quicker.

AllOlli
Jul 17 '05 #9

P: n/a
"Oliver Grätz" <ol***********@gmx.de> wrote in message
news:40***********************@newsread4.arcor-online.net...
toufik toufik schrieb:
Hi,
I've a web site in the address http://mySite.com
in the root, I've a file index.html

I've some subfiolders insid root/sub1/sub2

I like to add an html file (or php) index.html that call the index.html of the root (in order to protect)
Now I've created 2 different index.html because I use relative path to
design the root (../index.html and ../../index.html)

I like to have the same file in all folders,but I don't know how to call the root folder.


You could do a redirect:

$domain=$_SERVER['HTTP_HOST'];
header("Location: http://$domain/index.html");

Or simply include it with this index.php:

<?php include('/index.html'); ?>


This most likely will *not* work as the include paths are system paths, not
paths from the webroot.

- Virgil
Jul 17 '05 #10

P: n/a
Virgil Green schrieb:
<?php include('/index.html'); ?>


This most likely will *not* work as the include paths are system paths, not
paths from the webroot.


Oh, total blackout on my side. Yes, it certainly won't work unless you
have your own server and use a chroot-environment like I do...

AllOLLi
Jul 17 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.