Re: about the absolutely path

From: Date: Mon, 06 Jun 2005 22:43:29 +0000
Subject: Re: about the absolutely path
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-216533@lists.php.net to get a copy of this message
Richard Lynch wrote:
On Mon, June 6, 2005 1:54 am, yangshiqi said:
I have a php application (let's call it app A) which is developed separated in a test domain name, like http://testa.xxx.com <http://testa.xxx.com/> /. But now I have to move it to another app (called B) using http://testb.xxx.com <http://testb.xxx.com/> /, and the app A becomes just a subsystem of app B. The access url is changed to http://testb.xxx.com/a/. Then I meet a problem that the app A 's links, the path and other elements in it are set like '/Main.php', '/art/logo.gif' by an absolutely path. The app A is very independent and I do not want to disperse it to app B. So how can I get this effect: when the user input the url, ' http://testb.xxx.com/a/ ', the app A will work fine? Can I just modify some configuration about yapache to fit this requirement?
maybe you could use the apache ProxyPass directive? ProxyPass testb.xxx.com/a/ testa.xxx.com or something like that. (I'm just half-remembering a cool post by Rasmus L. so the syntax is probably off)
...
server with VirtualHost settings. [He says blithely, never having actually got that to work on his own box...] Hmmmm, that reminds me... Does VirtualHost rely on, like, /etc/hosts having hostnames for all those made-up hostnames I use? I had assumed all
Richard try something like this (obviously add any required stuff like DocumentRoot etc. # you can do allsorts of stuff with the IP definition. #NameVirtualHost 213.*:80 NameVirtualHost *:80 # _DEFAULT_ - this vhost gets loaded. if nothing else matches # ----------------------------------------------------------------- <VirtualHost _default_:80>
        ServerName www.l-i-e.com
        ServerAlias l-i-e.com
        DocumentRoot /var/www/l-i-e.com
</VirtualHost> <VirtualHost *:80> ServerName richard.l-i-e.com ServerAlias rlynch.l-i-e.com # stuff </VirtualHost> # whats this then! <VirtualHost 67.139.134.202:80>
    # if you create a directory
    # in /var/webroots/ that
    # matches the domainname given to apache
    # then the dir will be served.
    <Directory /var/webroots>
        Options ExecCGI +FollowSymLinks
    </Directory>
    UseCanonicalName Off
    ServerName %0
    # '%-2+' traps the penultimate and all preceding parts of the FQDN as given in the Host: header
    # but I wasn't having much luck with it.
    VirtualDocumentRoot /var/webroots/%0
    # some std resources?
    Alias  /css  /var/webroots/include/css
    Alias  /js   /var/webroots/include/js
    php_value auto_prepend_file /some/include/file.inc.php
</VirtualHost>
those hostnames were just internal unique markers for httpd.conf with no real-worl meaning... Was that just silly of me or what?
Richard, I believe you can have apache do lookups on the given names but by default its off at least - I never have any problem putting allsorts non-existing domains in the vhost confs, as long as your local HOSTS file has a suitable entry your rolling. rgds, Jochem


« previous php.general (#216533) next »