Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

VirtualHosts and Absolute addressing in HTML

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Apache-contrib  
Author Message
user2360

External


Since: Jul 05, 2003
Posts: 4



(Msg. 1) Posted: Sat Jul 05, 2003 4:40 pm
Post subject: VirtualHosts and Absolute addressing in HTML
Archived from groups: alt>apache>configuration (more info?)

Hi,

I'm up to my knees in crocodiles on this, and rapidly forgetting that
my original intention was to drain the swamp.

I'm using Apache 1.3.27 (installed using PHPDev 4) to maintain a
number of Web sites. I use my local PC for development only (not as a
live server) and I'm having problems with absolute addressing in the
HTML (changing to relative addressing is not an option).

In summary, my absolute addressing is resolving to an address of
"E:\phpdev\www" for all but the first VirtualHost - I want it to
resolve to the root of the relevant site for each site, as it will
when published to the live server.

This is what I have on my PC: -

E:\phpdev\www\site-a
E:\phpdev\www\site-b
.... etc.

From reading posts here and elsewhere, I understand that VirtualHosts
is (probably?) the answer, however I'm having problems - this is my
HTTPD.CONF: -

NameVirtualHost *

<VirtualHost *>
ServerName www.site-a.co.uk
DocumentRoot E:/phpdev/www/site-a
</VirtualHost>

<VirtualHost *>
ServerName www.site-b.co.uk
DocumentRoot E:/phpdev/www/site-b
</VirtualHost>

....etc


I've fiddled-around with variations on this theme ("127.0.0.1/2" in
place of "*") - I've also tried "127.0.0.n www.site-x.co.uk" in the
"windows/host" file - all without a result.

I've tried the HTML "<base ...>" option, but that results in an
attempt to connect to the Internet (I did that with the above "host"
file entries and with Apache active - shouldn't Apache have caught it
and passed it to me locally as 127.0.0.1 ?).

Am I crying for the moon here?

Any advice appreciated.

--
Nick Michell
Doff Your Hat for personal reply.

 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
jimbo3361

External


Since: Jul 03, 2003
Posts: 7



(Msg. 2) Posted: Sat Jul 05, 2003 10:50 pm
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

heh , are you running thru a router ? if so , read my solution posted
earlier... a firewall ?? if so , shut it down and test code again .. maybe
this will help , I got mine up and running finally ...
"Nick Michell" <nickmATavnetYourHat.co.uk> wrote in message
news:7mhdgv89tfuee9es75r7p6d6apo2g7g1ho@4ax.com...
 > Hi,
 >
 > I'm up to my knees in crocodiles on this, and rapidly forgetting that
 > my original intention was to drain the swamp.
 >
 > I'm using Apache 1.3.27 (installed using PHPDev 4) to maintain a
 > number of Web sites. I use my local PC for development only (not as a
 > live server) and I'm having problems with absolute addressing in the
 > HTML (changing to relative addressing is not an option).
 >
 > In summary, my absolute addressing is resolving to an address of
 > "E:\phpdev\www" for all but the first VirtualHost - I want it to
 > resolve to the root of the relevant site for each site, as it will
 > when published to the live server.
 >
 > This is what I have on my PC: -
 >
 > E:\phpdev\www\site-a
 > E:\phpdev\www\site-b
 > ... etc.
 >
 > From reading posts here and elsewhere, I understand that VirtualHosts
 > is (probably?) the answer, however I'm having problems - this is my
 > HTTPD.CONF: -
 >
 > NameVirtualHost *
 >
 > <VirtualHost *>
<font color=purple> > ServerName <a style='text-decoration: underline;' href="http://www.site-a.co.uk</font" target="_blank">www.site-a.co.uk</font</a>>
 > DocumentRoot E:/phpdev/www/site-a
 > </VirtualHost>
 >
 > <VirtualHost *>
<font color=purple> > ServerName <a style='text-decoration: underline;' href="http://www.site-b.co.uk</font" target="_blank">www.site-b.co.uk</font</a>>
 > DocumentRoot E:/phpdev/www/site-b
 > </VirtualHost>
 >
 > ...etc
 >
 >
 > I've fiddled-around with variations on this theme ("127.0.0.1/2" in
 > place of "*") - I've also tried "127.0.0.n <a style='text-decoration: underline;' href="http://www.site-x.co.uk" target="_blank">www.site-x.co.uk</a>" in the
 > "windows/host" file - all without a result.
 >
 > I've tried the HTML "<base ...>" option, but that results in an
 > attempt to connect to the Internet (I did that with the above "host"
 > file entries and with Apache active - shouldn't Apache have caught it
 > and passed it to me locally as 127.0.0.1 ?).
 >
 > Am I crying for the moon here?
 >
 > Any advice appreciated.
 >
 > --
 > Nick Michell
 > Doff Your Hat for personal reply.<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
user2348

External


Since: Jun 28, 2003
Posts: 203



(Msg. 3) Posted: Sun Jul 06, 2003 1:32 pm
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Nick Michell" <nickmATavnetYourHat.co.uk> wrote in message
news:7mhdgv89tfuee9es75r7p6d6apo2g7g1ho@4ax.com...

 > In summary, my absolute addressing is resolving to an address of
 > "E:\phpdev\www" for all but the first VirtualHost - I want it to
 > resolve to the root of the relevant site for each site, as it will
 > when published to the live server.

What method are you using to get your document root? If you are getting the
doc_root variable (from the INI file) then you will only be able to get one
value for it. Using the server variable $_SERVER['DOCUMENT_ROOT']; I get the
correct document root, and I have basically the same virtual host setup as
you.

As for the rest of my setup, Apache2, PHP 4.3.2, WinXP. So this could be
different on Apache 1.3, with whatever version of PHP you have, but then
maybe it's time to upgrade?

Richard.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
user2360

External


Since: Jul 05, 2003
Posts: 4



(Msg. 4) Posted: Sun Jul 06, 2003 2:00 pm
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

No router involved. Tried closing my firewall - no difference. I also
tried nesting "<Directory>" within "<VirtualHost>", as suggested by
Davide in the thread you refer to - still no joy.

I'm finding this very frustrating - I see from other posts that this
is a common problem, and I'll probably kick myself when I resolve it -
I'm still open to any and all suggestions.

On Sat, 05 Jul 2003 19:50:22 GMT, "Jimbo" <jimbo3361 RemoveThis @shaw.ca> wrote:

 >heh , are you running thru a router ? if so , read my solution posted
 >earlier... a firewall ?? if so , shut it down and test code again .. maybe
 >this will help , I got mine up and running finally ...

--
Nick Michell
Doff Your Hat for personal reply.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
user2360

External


Since: Jul 05, 2003
Posts: 4



(Msg. 5) Posted: Sun Jul 06, 2003 6:22 pm
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sun, 06 Jul 2003 10:32:37 GMT, "Richard Antony Burton"
<richardaburton-NOSPAM-.TakeThisOut@hotmail.com> wrote:

 >What method are you using to get your document root? If you are getting the
 >doc_root variable (from the INI file) then you will only be able to get one
 >value for it. Using the server variable $_SERVER['DOCUMENT_ROOT']; I get the
 >correct document root, and I have basically the same virtual host setup as
 >you.

Sorry - I may not have stated the problem correctly. My problem is
with the following HTML: -

<img src="/images/abc.gif"

The file containing the above is included at various levels within the
site, hence the need for absolute addressing. It works fine when
published to the live server, but when served locally (under Apache)
it is resolving to "localhost/images/abc.gif" instead of
localhost/site-a/images.abc.gif".

 >As for the rest of my setup, Apache2, PHP 4.3.2, WinXP. So this could be
 >different on Apache 1.3, with whatever version of PHP you have, but then
 >maybe it's time to upgrade?

I'm a newcomer to all this (just have a little experience developing
"static" HTML) - are you saying this could be a bug in Apache 1.3.27?

--
Nick Michell
Doff Your Hat for personal reply.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
user2348

External


Since: Jun 28, 2003
Posts: 203



(Msg. 6) Posted: Sun Jul 06, 2003 6:33 pm
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Nick Michell" <nickmATavnetYourHat.co.uk> wrote in message
news:fcbggvkbr1skn5u1kusetjg525j96hlhhv@4ax.com...

 > Sorry - I may not have stated the problem correctly. My problem is
 > with the following HTML: -
 >
 > <img src="/images/abc.gif"
 >
 > The file containing the above is included at various levels within the
 > site, hence the need for absolute addressing. It works fine when
 > published to the live server, but when served locally (under Apache)
 > it is resolving to "localhost/images/abc.gif" instead of
 > localhost/site-a/images.abc.gif".

Ok, now I see what you are after. You will need to use name based virtual
hosting. The config in your original post looks alright. Then add entries to
your hosts file, such as:
127.0.0.1 site-a
127.0.0.1 site-b

Then access the site using <a style='text-decoration: underline;' href="http://site-a/" target="_blank">http://site-a/</a> <a style='text-decoration: underline;' href="http://site-b/" target="_blank">http://site-b/</a> etc.

 > I'm a newcomer to all this (just have a little experience developing
 > "static" HTML) - are you saying this could be a bug in Apache 1.3.27?

No, I was suggesting that it the variables available to PHP could be
different with Apache 2. However this is now not the issue, so not to worry
(though I would still recommend Apache 2 over 1.3).

Richard.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
user2360

External


Since: Jul 05, 2003
Posts: 4



(Msg. 7) Posted: Sun Jul 06, 2003 11:39 pm
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for your help Richard, but it still ain't flyin'

The first VirtualHost works fine, the second not. I suppose I'll just
have to keep amending httpd.conf to make the site I'm working on the
first VirtualHost. Maybe Apache 2 will fix it.

Thanks again.

--
Nick Michell
Doff Your Hat for personal reply.
 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
user2348

External


Since: Jun 28, 2003
Posts: 203



(Msg. 8) Posted: Mon Jul 07, 2003 1:11 am
Post subject: Re: VirtualHosts and Absolute addressing in HTML [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Nick Michell" <nickmATavnetYourHat.co.uk> wrote in message
news:6fuggv4ikbkkb9bfmf6n1rkrahi4g2c34t@4ax.com...
 > Thanks for your help Richard, but it still ain't flyin'
 >
 > The first VirtualHost works fine, the second not. I suppose I'll just
 > have to keep amending httpd.conf to make the site I'm working on the
 > first VirtualHost. Maybe Apache 2 will fix it.

Could be that your browser isn't using HTTP/1.1. If you make a HTTP/1.0
request you will be served the first name based virtual host IIRC.

Richard.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VirtualHosts and Absolute addressing in HTML 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Apache not displaying index.html.en - Hey all, Just installed Apache 2. When i type http://server/manual - i get a 404 If i type http://server/manual/index.html.en it works, and shows the index page. Also, any link from the index page fails, because the links are to ..html but the files..
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]