Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > Linux ~user with root-relative links

Reply
Thread Tools

Linux ~user with root-relative links

 
 
dave conz
Guest
Posts: n/a
 
      05-06-2004
I have just set up a Red Hat 9 box to test websites and eventually be a
file server for our LAN. That's all it will need to do.

I have set up Apache to enable userdir so I can browse the sites by
going to http://10.0.0.1/~user. It's going fine, but the problem is that
I use a lot of root-relative links in my websites. Apache is looking for
these links relative to the host IP address (10.0.0.1) rather than the
user's document root (10.0.0.1/~user).

Because I have numerous different users/websites on the go at any time,
I really need to have a system that works without having to continually
reconfigure document roots etc.

Any suggestions for a way around this?

-dave

 
Reply With Quote
 
 
 
 
AD.
Guest
Posts: n/a
 
      05-06-2004
On Thu, 06 May 2004 12:46:22 +1200, dave conz wrote:

> I have just set up a Red Hat 9 box to test websites and eventually be a
> file server for our LAN. That's all it will need to do.
>
> I have set up Apache to enable userdir so I can browse the sites by going
> to http://10.0.0.1/~user. It's going fine, but the problem is that I use a
> lot of root-relative links in my websites. Apache is looking for these
> links relative to the host IP address (10.0.0.1) rather than the user's
> document root (10.0.0.1/~user).
>
> Because I have numerous different users/websites on the go at any time, I
> really need to have a system that works without having to continually
> reconfigure document roots etc.
>
> Any suggestions for a way around this?


If you don't want to change all the links to the appropriate parent
paths, you would probably have to set up a virtual host for each user in
Apache.

http://httpd.apache.org/docs/vhosts/index.html

If you have lots of users and they change a lot, there are ways of
automating it (I haven't tried this):

http://httpd.apache.org/docs/vhosts/mass.html

For our web designers, I set up a Debian server on our LAN with 10 virtual
hosts on it eg webdev1, webdev2 etc put all the aliases in the DNS and
also created a samba share to each host.

Then they could edit SSI and php file to their hearts content, as well as
copy whole sites in and out at once from their Windows desktops. 10 slots
was enough for all the projects they had on at once.

Cheers
Anton

 
Reply With Quote
 
 
 
 
steve
Guest
Posts: n/a
 
      05-06-2004
dave conz wrote:
> I have just set up a Red Hat 9 box to test websites and eventually be a
> file server for our LAN. That's all it will need to do.
>
> I have set up Apache to enable userdir so I can browse the sites by
> going to http://10.0.0.1/~user. It's going fine, but the problem is that
> I use a lot of root-relative links in my websites. Apache is looking for
> these links relative to the host IP address (10.0.0.1) rather than the
> user's document root (10.0.0.1/~user).
>
> Because I have numerous different users/websites on the go at any time,
> I really need to have a system that works without having to continually
> reconfigure document roots etc.
>
> Any suggestions for a way around this?
>
> -dave
>


How is your httpd.conf set up?

I use "Virtualhost" in the httpd.conf - and each entry defines the
'root' for that site.

With Apache 2.0.49 (below /var) I use this option (along with others)

DocumentRoot /www/<site-whatever>/html



 
Reply With Quote
 
Patrick Dunford
Guest
Posts: n/a
 
      05-06-2004
dave conz
> I have just set up a Red Hat 9 box to test websites and eventually be a
> file server for our LAN. That's all it will need to do.
>
> I have set up Apache to enable userdir so I can browse the sites by
> going to http://10.0.0.1/~user. It's going fine, but the problem is that
> I use a lot of root-relative links in my websites. Apache is looking for
> these links relative to the host IP address (10.0.0.1) rather than the
> user's document root (10.0.0.1/~user).
>
> Because I have numerous different users/websites on the go at any time,
> I really need to have a system that works without having to continually
> reconfigure document roots etc.
>
> Any suggestions for a way around this?


No this is how Apache works, the web site root is not the site root and
never will be, since the directories in question are subdirectories off
the root.

You might want to look at virtual hosting instead and I believe there are
mechanisms for bulk configuration of this.
 
Reply With Quote
 
pbs
Guest
Posts: n/a
 
      05-06-2004
dave conz wrote:
> I have just set up a Red Hat 9 box to test websites and eventually be a
> file server for our LAN. That's all it will need to do.
>
> I have set up Apache to enable userdir so I can browse the sites by
> going to http://10.0.0.1/~user. It's going fine, but the problem is that
> I use a lot of root-relative links in my websites. Apache is looking for


Why use "root-relative" links?

> these links relative to the host IP address (10.0.0.1) rather than the
> user's document root (10.0.0.1/~user).


Why not use links relative to the current URL (document)?
eg <A HREF="subdir/index.html">subdir index</A>
not <A HREF="http://10.0.0.1/subdir/index.html">subdir index</A>
and not <A HREF="/subdir/index.html">subdir index</A>

In the long run it makes it much easier to manage a site when the
invertible move and reorganise of sets of web pages becomes necessary.
Just the sort of thing you are describing here.
 
Reply With Quote
 
Patrick Dunford
Guest
Posts: n/a
 
      05-07-2004
pbs
> dave conz wrote:
> > I have just set up a Red Hat 9 box to test websites and eventually be a
> > file server for our LAN. That's all it will need to do.
> >
> > I have set up Apache to enable userdir so I can browse the sites by
> > going to http://10.0.0.1/~user. It's going fine, but the problem is that
> > I use a lot of root-relative links in my websites. Apache is looking for

>
> Why use "root-relative" links?
>
> > these links relative to the host IP address (10.0.0.1) rather than the
> > user's document root (10.0.0.1/~user).

>
> Why not use links relative to the current URL (document)?
> eg <A HREF="subdir/index.html">subdir index</A>
> not <A HREF="http://10.0.0.1/subdir/index.html">subdir index</A>
> and not <A HREF="/subdir/index.html">subdir index</A>
>
> In the long run it makes it much easier to manage a site when the
> invertible move and reorganise of sets of web pages becomes necessary.
> Just the sort of thing you are describing here.


If your site uses a set of common images, includes etc, you'll want to
use templates that have the absolute path to that image embedded in them
so that it doesn't have to be changed every time you save the file in a
different directory. I always use this on my websites using / as the
root, not the full server name starting with http://

 
Reply With Quote
 
Enkidu
Guest
Posts: n/a
 
      05-08-2004
On Sat, 8 May 2004 00:29:44 +1200, Patrick Dunford
<(E-Mail Removed)> wrote:

>pbs
>> dave conz wrote:
>> > I have just set up a Red Hat 9 box to test websites and eventually be a
>> > file server for our LAN. That's all it will need to do.
>> >
>> > I have set up Apache to enable userdir so I can browse the sites by
>> > going to http://10.0.0.1/~user. It's going fine, but the problem is that
>> > I use a lot of root-relative links in my websites. Apache is looking for

>>
>> Why use "root-relative" links?
>>
>> > these links relative to the host IP address (10.0.0.1) rather than the
>> > user's document root (10.0.0.1/~user).

>>
>> Why not use links relative to the current URL (document)?
>> eg <A HREF="subdir/index.html">subdir index</A>
>> not <A HREF="http://10.0.0.1/subdir/index.html">subdir index</A>
>> and not <A HREF="/subdir/index.html">subdir index</A>
>>
>> In the long run it makes it much easier to manage a site when the
>> invertible move and reorganise of sets of web pages becomes necessary.
>> Just the sort of thing you are describing here.

>
>If your site uses a set of common images, includes etc, you'll want to
>use templates that have the absolute path to that image embedded in them
>so that it doesn't have to be changed every time you save the file in a
>different directory. I always use this on my websites using / as the
>root, not the full server name starting with http://


Why not use virtual directories? I tend to have a single directory for
common images like nav buttons. So the URL for an image might be
/common-images/right-arrow.gif, with a physical address of
/images/right-arrow.gif. For the site specific images I usually create
another directory /images usually outside the site's physical address
as a virtual directory for that site. That way you can use relative
URLs everywhere and no absolute paths on the pages whatsoever.

Cheers,

Cliff
 
Reply With Quote
 
Patrick Dunford
Guest
Posts: n/a
 
      05-09-2004
Enkidu
> On Sat, 8 May 2004 00:29:44 +1200, Patrick Dunford
> <(E-Mail Removed)> wrote:
>
> >pbs
> >> dave conz wrote:
> >> > I have just set up a Red Hat 9 box to test websites and eventually be a
> >> > file server for our LAN. That's all it will need to do.
> >> >
> >> > I have set up Apache to enable userdir so I can browse the sites by
> >> > going to http://10.0.0.1/~user. It's going fine, but the problem is that
> >> > I use a lot of root-relative links in my websites. Apache is looking for
> >>
> >> Why use "root-relative" links?
> >>
> >> > these links relative to the host IP address (10.0.0.1) rather than the
> >> > user's document root (10.0.0.1/~user).
> >>
> >> Why not use links relative to the current URL (document)?
> >> eg <A HREF="subdir/index.html">subdir index</A>
> >> not <A HREF="http://10.0.0.1/subdir/index.html">subdir index</A>
> >> and not <A HREF="/subdir/index.html">subdir index</A>
> >>
> >> In the long run it makes it much easier to manage a site when the
> >> invertible move and reorganise of sets of web pages becomes necessary.
> >> Just the sort of thing you are describing here.

> >
> >If your site uses a set of common images, includes etc, you'll want to
> >use templates that have the absolute path to that image embedded in them
> >so that it doesn't have to be changed every time you save the file in a
> >different directory. I always use this on my websites using / as the
> >root, not the full server name starting with http://

>
> Why not use virtual directories? I tend to have a single directory for
> common images like nav buttons. So the URL for an image might be
> /common-images/right-arrow.gif, with a physical address of
> /images/right-arrow.gif. For the site specific images I usually create
> another directory /images usually outside the site's physical address
> as a virtual directory for that site. That way you can use relative
> URLs everywhere and no absolute paths on the pages whatsoever.


And then what does your relative URL look like?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Is Netscape Leaving Firefox Behind on GNU/Linux? THE LINUX PROPAGANDA MACHINE CONTINUES. FIREFOX IGNORING LINUX............. traci.manicotti@gmail.com Computer Support 2 10-20-2007 02:12 PM
Make A Shorter Link - no new links accepted, old links still work. why? Computer Support 7 01-02-2007 09:45 PM
Linux... yeah linux.. Linux Have a nice cup of pee NZ Computing 19 04-17-2006 10:16 AM
Site Links and Physical WAN Links =?Utf-8?B?RW5mb1BhdWw=?= MCSE 2 03-22-2005 09:23 AM
Exchange Links < Western Cartoon Cards > Exchange Links www.westerncartooncards.ca HTML 2 07-12-2004 07:59 PM



Advertisments