winNT redirect in code

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

    winNT redirect in code

    Is there a way to insert code, in a php file, to redirect the location of
    the Apache DocumentRoot to another directory? I have looked all over the
    place for something like this.

    Thx ahead, Doug Eilertson


  • Tim Van Wassenhove

    #2
    Re: winNT redirect in code

    In article <hLuJc.25879$Jk 2.5693@roc.nntp server.com>, Doug wrote:[color=blue]
    > Is there a way to insert code, in a php file, to redirect the location of
    > the Apache DocumentRoot to another directory? I have looked all over the
    > place for something like this.[/color]

    I don't see the use for such a function????

    - If you can't change the documentroot, a symlink might help.
    - With mod_rewrite you can map all the request for a site to a single
    script, that maps the request to the script in the other dir.

    --
    Tim Van Wassenhove <http://home.mysth.be/~timvw>

    Comment

    • Doug

      #3
      Re: winNT redirect in code



      "Tim Van Wassenhove" <euki@pi.be> wrote in message
      news:2lnejlFe65 lsU1@uni-berlin.de...[color=blue]
      > In article <hLuJc.25879$Jk 2.5693@roc.nntp server.com>, Doug wrote:[color=green]
      > > Is there a way to insert code, in a php file, to redirect the location[/color][/color]
      of[color=blue][color=green]
      > > the Apache DocumentRoot to another directory? I have looked all over[/color][/color]
      the[color=blue][color=green]
      > > place for something like this.[/color]
      >
      > I don't see the use for such a function????
      >
      > - If you can't change the documentroot, a symlink might help.
      > - With mod_rewrite you can map all the request for a site to a single
      > script, that maps the request to the script in the other dir.
      >
      > --
      > Tim Van Wassenhove <http://home.mysth.be/~timvw>[/color]

      My thinking is that with different development projects in different
      directories, it would be easier to just include the change from htdocs to
      the development directory of choice instead of manually changing the
      DocumentRoot everytime you want to change it.


      Comment

      • Brian

        #4
        Re: winNT redirect in code

        Doug wrote:
        [color=blue]
        > Is there a way to insert code, in a php file, to redirect the
        > location of the Apache DocumentRoot to another directory?[/color]

        Not in PHP, no. But you have alias, scriptalias, redirect, and rewrite
        modules. The first 2 especially should help you, if I understand what
        you want.

        --
        Brian (remove ".invalid" to email me)

        Comment

        • Tim Van Wassenhove

          #5
          Re: winNT redirect in code

          In article <LRvJc.26264$Jk 2.8945@roc.nntp server.com>, Doug wrote:[color=blue]
          >
          >
          > "Tim Van Wassenhove" <euki@pi.be> wrote in message
          > news:2lnejlFe65 lsU1@uni-berlin.de...[color=green]
          >> In article <hLuJc.25879$Jk 2.5693@roc.nntp server.com>, Doug wrote:[color=darkred]
          >> > Is there a way to insert code, in a php file, to redirect the location[/color][/color]
          > of[color=green][color=darkred]
          >> > the Apache DocumentRoot to another directory? I have looked all over[/color][/color]
          > the[color=green][color=darkred]
          >> > place for something like this.[/color]
          >>
          >> I don't see the use for such a function????
          >>
          >> - If you can't change the documentroot, a symlink might help.
          >> - With mod_rewrite you can map all the request for a site to a single
          >> script, that maps the request to the script in the other dir.[/color][/color]
          [color=blue]
          > My thinking is that with different development projects in different
          > directories, it would be easier to just include the change from htdocs to
          > the development directory of choice instead of manually changing the
          > DocumentRoot everytime you want to change it.[/color]

          I would do it somewhat like this:

          In /etc/hosts
          127.0.0.1 localhost test

          In /etc/apache/httpd.conf
          <VirtualHost 127.0.0.1>
          ServerName localhost
          DocumentRoot /var/www
          </VirtualHost>

          <VirtualHost 127.0.0.1>
          ServerName test
          DocumentRoot /home/timvw/www
          </VirtualHost>

          All my projects are in /home/timvw/src
          /home/timvw/src/host1
          /home/timvw/src/host2

          In /var/www have a script that
          lists all the folders in /home/timvw/src
          creates a symlink from the selected folder to /home/timvw/www

          --
          Tim Van Wassenhove <http://home.mysth.be/~timvw>

          Comment

          • steve

            #6
            Re: Re: winNT redirect in code

            "Doug" wrote:[color=blue]
            > "Tim Van Wassenhove" <euki@pi.be> wrote in message
            > news:2lnejlFe65 lsU1@uni-berlin.de...[color=green]
            > > In article <hLuJc.25879$Jk 2.5693@roc.nntp server.com>, Doug[/color]
            > wrote:[color=green][color=darkred]
            > > > Is there a way to insert code, in a php file, to redirect[/color][/color]
            > the location
            > of[color=green][color=darkred]
            > > > the Apache DocumentRoot to another directory? I have looked[/color][/color]
            > all over
            > the[color=green][color=darkred]
            > > > place for something like this.[/color]
            > >
            > > I don’t see the use for such a function????
            > >
            > > - If you can’t change the documentroot, a symlink might[/color]
            > help.[color=green]
            > > - With mod_rewrite you can map all the request for a site to a[/color]
            > single[color=green]
            > > script, that maps the request to the script in the other dir.
            > >
            > > --
            > > Tim Van Wassenhove <http://home.mysth.be/~timvw>[/color]
            >
            > My thinking is that with different development projects in[/color]
            different[color=blue]
            > directories, it would be easier to just include the change from[/color]
            htdocs[color=blue]
            > to
            > the development directory of choice instead of manually changing[/color]
            the[color=blue]
            > DocumentRoot everytime you want to change it.[/color]

            As Tim said, simply manipulate a symbolic link to your dev. directory.
            This link is placed in the htdocs directory. So this way, you don’t
            have to change httpd.conf or reboot apache.

            For the case where multiple people are working on different dev’s and
            need to access the same web server, I think you have to set up dns,
            and map each of them to a virtual host which is setup in httpd.conf
            (too complex!!).

            --
            http://www.dbForumz.com/ This article was posted by author's request
            Articles individually checked for conformance to usenet standards
            Topic URL: http://www.dbForumz.com/PHP-winNT-re...ict129774.html
            Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=433121

            Comment

            • Chung Leong

              #7
              Re: winNT redirect in code

              "Tim Van Wassenhove" <euki@pi.be> wrote in message
              news:2lnejlFe65 lsU1@uni-berlin.de...[color=blue]
              > In article <hLuJc.25879$Jk 2.5693@roc.nntp server.com>, Doug wrote:[color=green]
              > > Is there a way to insert code, in a php file, to redirect the location[/color][/color]
              of[color=blue][color=green]
              > > the Apache DocumentRoot to another directory? I have looked all over[/color][/color]
              the[color=blue][color=green]
              > > place for something like this.[/color]
              >
              > I don't see the use for such a function????
              >
              > - If you can't change the documentroot, a symlink might help.
              > - With mod_rewrite you can map all the request for a site to a single
              > script, that maps the request to the script in the other dir.
              >
              > --
              > Tim Van Wassenhove <http://home.mysth.be/~timvw>[/color]

              But wait. On Windows there are no symlinks. What you can do is use the SUBST
              command to map a directory to a virtual drive.


              Comment

              • steve

                #8
                Re: Re: winNT redirect in code

                "Chung Leong" wrote:[color=blue]
                > "Tim Van Wassenhove" <euki@pi.be> wrote in message
                > news:2lnejlFe65 lsU1@uni-berlin.de...
                > ...
                >
                > But wait. On Windows there are no symlinks. What you can do is use[/color]
                the[color=blue]
                > SUBST
                > command to map a directory to a virtual drive.[/color]

                oops, I missed "NT" in the title. You are right, I was thinking
                *nix.

                --
                http://www.dbForumz.com/ This article was posted by author's request
                Articles individually checked for conformance to usenet standards
                Topic URL: http://www.dbForumz.com/PHP-winNT-re...ict129774.html
                Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=434970

                Comment

                Working...