the root folder

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • toufik toufik

    the root folder

    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


  • Virgil Green

    #2
    Re: the root folder

    "toufik toufik" <toufiki@sympat ico.ca> wrote in message
    news:DEghc.1264 4$CO3.662052@ne ws20.bellglobal .com...[color=blue]
    > 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[/color]
    the[color=blue]
    > root folder.
    > Any help please?[/color]

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

    - Virgil


    Comment

    • toufik toufik

      #3
      Re: the root folder

      Thanks.

      I like to call the file:

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



      "Virgil Green" <vjg@obsydian.c om> wrote in message
      news:QShhc.1947 7$CN2.13342@new ssvr22.news.pro digy.com...[color=blue]
      > "toufik toufik" <toufiki@sympat ico.ca> wrote in message
      > news:DEghc.1264 4$CO3.662052@ne ws20.bellglobal .com...[color=green]
      > > 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[/color][/color]
      of[color=blue][color=green]
      > > 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[/color]
      > the[color=green]
      > > root folder.
      > > Any help please?[/color]
      >
      > Are you trying to include the file or create a link to it? That is quite
      > unclear.
      >
      > - Virgil
      >
      >[/color]


      Comment

      • Pertti Kosunen

        #4
        Re: the root folder

        "toufik toufik" <toufiki@sympat ico.ca> wrote in message
        news:DEghc.1264 4$CO3.662052@ne ws20.bellglobal .com...[color=blue]
        > 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[/color]
        the[color=blue]
        > root folder.[/color]

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

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

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


        Comment

        • toufik toufik

          #5
          Re: the root folder

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

          http://mysite2......

          And I like that the code works in all situations

          Thanks.

          "Pertti Kosunen" <pertti.kosunen @kolumb.us.fi_i nvalid> wrote in message
          news:c65omk$saq $1@phys-news1.kolumbus. fi...[color=blue]
          > "toufik toufik" <toufiki@sympat ico.ca> wrote in message
          > news:DEghc.1264 4$CO3.662052@ne ws20.bellglobal .com...[color=green]
          > > 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[/color][/color]
          of[color=blue][color=green]
          > > 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[/color]
          > the[color=green]
          > > root folder.[/color]
          >
          > If you want sub1/index.php and other subN/index.php to redirect to root,[/color]
          use[color=blue]
          > header function.
          >
          > <?php
          > header("Locatio n: http://mysite.com/index.html"); /* Redirect browser */
          >
          > /* Make sure that code below does not get executed when we redirect. */
          > exit;
          > ?>
          >
          >[/color]


          Comment

          • Virgil Green

            #6
            Re: the root folder

            "toufik toufik" <toufiki@sympat ico.ca> wrote in message
            news:8_hhc.1295 2$CO3.677019@ne ws20.bellglobal .com...[color=blue]
            > Thanks.
            >
            > I like to call the file:
            >
            > <body onload="documen t.location.href ='../../index.html';">[/color]

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

            - Virgil


            Comment

            • Pertti Kosunen

              #7
              Re: the root folder

              "toufik toufik" <toufiki@sympat ico.ca> wrote in message
              news:l3vhc.1531 0$CO3.827694@ne ws20.bellglobal .com...[color=blue]
              > 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[/color]



              You can use $_SERVER['HTTP_HOST'].

              <?php
              header("Locatio n: http://" . $_SERVER['HTTP_HOST'] . "/");
              ?>


              Comment

              • Jan Pieter Kunst

                #8
                Re: the root folder

                In article <l3vhc.15310$CO 3.827694@news20 .bellglobal.com >,
                "toufik toufik" <toufiki@sympat ico.ca> wrote:
                [color=blue]
                > 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.[/color]

                Then you can do this:

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

                JP

                --
                Sorry, <devnull@cauce. org> is een "spam trap".
                E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

                Comment

                • Oliver Grätz

                  #9
                  Re: the root folder

                  toufik toufik schrieb:[color=blue]
                  > 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.[/color]

                  You could do a redirect:

                  $domain=$_SERVE R['HTTP_HOST'];
                  header("Locatio n: 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

                  Comment

                  • Virgil Green

                    #10
                    Re: the root folder

                    "Oliver Grätz" <oliver.graetz@ gmx.de> wrote in message
                    news:40878b7b$0 $15488$9b4e6d93 @newsread4.arco r-online.net...[color=blue]
                    > toufik toufik schrieb:[color=green]
                    > > 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[/color][/color]
                    of[color=blue][color=green]
                    > > 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[/color][/color]
                    the[color=blue][color=green]
                    > > root folder.[/color]
                    >
                    > You could do a redirect:
                    >
                    > $domain=$_SERVE R['HTTP_HOST'];
                    > header("Locatio n: http://$domain/index.html");
                    >
                    > Or simply include it with this index.php:
                    >
                    > <?php include('/index.html'); ?>[/color]

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

                    - Virgil


                    Comment

                    • Oliver Grätz

                      #11
                      Re: the root folder

                      Virgil Green schrieb:[color=blue][color=green]
                      >><?php include('/index.html'); ?>[/color]
                      >
                      > This most likely will *not* work as the include paths are system paths, not
                      > paths from the webroot.
                      >[/color]

                      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


                      Comment

                      Working...