Want NCSA HTTPd to redirect based on hostname..

Want NCSA HTTPd to redirect based on hostname..

Post by Jase P Wel » Sat, 02 Aug 1997 04:00:00

I've got a web server named running NCSA HTTPd. The root directory of the
server is /usr/local/etc/httpd/htdocs.

There are several DNS names that all point to this same machine, i.e., you
can access the server with http://servername/ or http://serveralias/. What
I'd like to do is have http://serveralias/ actually drop users into the
directory at /usr/local/etc/httpd/htdocs/serveralias/.

Would I use the <VirtualHost> directive to accomplish this? If so, will
links back to the root directory take people to the
/usr/local/etc/httpd/htdocs/ directory (what I want), or will it only take
them to the /usr/local/etc/httpd/htdocs/serveralias/ directory?

Thanks for any tips,


Jase P Wells, MTS (the Web & Scopus guy)

555 North Mathilda Avenue                 Phone: (408) 523-8706
Sunnyvale, California  94086              Fax:   (408) 523-4601
To avoid mass junk-mail my address is munged in the Reply-To header.


1. NCSA httpd 1.5a: .htaccess redirects

I've been trying to get Redirects (Temp and Perm) to work from the
.htaccess file using NCSA httpd 1.5a on both Ultrix 4.4 and Linux
1.3.43 (and I'll try 1.2.13 over the weekend).

UserDir is set to WWW, rather than public_html.

In /home/dgymer/WWW/.htaccess I have:

-- snip --
# Redirects

# These work despite having no translation! But they don't work if the
# symlinks are removed!

Redirect /~dgymer/f1gputil/ http://www.mal.com/~dgymer/f1gp/util/
Redirect /~dgymer/f1gp-faq/ http://www.mal.com/~dgymer/f1gp/faq/
Redirect /~dgymer/f1gp-prf/ http://www.mal.com/~dgymer/f1gp/prf/
Redirect /~dgymer/f1gp-iv/ http://www.mal.com/~dgymer/f1gp/iv/
Redirect /~dgymer/lfrs/ http://www.mal.com/~dgymer/f1gp/lfrs/
Redirect /~dgymer/lf3000/ http://www.mal.com/~dgymer/f1gp/lf3000/
Redirect /~dgymer/wcpchof/ http://www.mal.com/~dgymer/f1gp/hof/
Redirect /~dgymer/lfstats/ http://www.mal.com/~dgymer/lf/
Redirect /~dgymer/f1gpmisc/ http://www.mal.com/~dgymer/f1gp/misc/

# This doesn't work right!
Redirect /~dgymer/home.html http://www.mal.com/~dgymer/f1gp/
-- snip --

As you might have guessed, I recently moved a lot of directories
into an "f1gp" hierarchy. With NCSA 1.4 I decided to make a "MOVED"
directory and populate it with some files telling people where to look
for the new stuff, and then created symlinks from the old names to
this directory.

So far so good. Then we switched to httpd 1.5a. "Oh goodie!" I
thought, "I can use .htaccess redirects now." Bong!

The directory redirects as listed above work. I note that the paths
aren't fully translated but let's ignore that minor detail. Well, they
work... until I remove the symlinks (which was the whole point,
really). Oh dear, now they don't work at all; all I get is 404 Not

The single file redirect (the last one, home.html) doesn't work at all
under Linux. It does work under Ultrix, but again, only as long as the
symlink stays there.

Help! Am I doing something wrong? Has anyone got this working?

Thanks in advance...

2. use of timeout()

3. NCSA Httpd: Redirects at user level?

4. Problem upgrading to apache 1.3.22-1

5. Help: NCSA httpd, Redirect, and QUERY_STRING

6. INstalling gcc 2.95.2 on AIX 4.3.2

7. Need help redirecting requests with NCSA httpd 1.3

8. Problem mounting FAT32 partition

9. A NCSA httpd redirect question

10. Redirect with NCSA HTTPD 1.5.2 and .htaccess

11. Efficient Alias and Redirect table lookup in NCSA httpd?

12. Q: trailing slash and redirects from NCSA httpd to OSU

13. Redirecting in .htaccess for NCSA httpd 1.5a