Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 07-21-2005, 07:10 PM   #1
Registered: Jul 2001
Distribution: Ubuntu
Posts: 195

Rep: Reputation: 30
make "localhost" point to a subdirectory of Apache server

Really this is for Mac OS X, but I figure I can apply linux thinking to the topic.

So thinking in terms of Linux, is it possible to do the following, and if so how?

What I want to do is be able to type something like http://localhost/ (though something different would be used) and have it redirect me to http://localhost/some/subdirectory/.

I don't know much about Apache, or anything else to do with servers, but this is the easiest way for me to implement a free database at work for keeping track of lab cultures, enzymes, etc (microbiology lab stuff). Right now I have it working great, with PHP. mySQL and Apache running perfectly together, but the people I work with won't use it unless it is incredibly easy to use, so having a long url to remember won't cut it.

We also use 3 different web browsers, so putting bookmarks in them works, but isn't the best solution. I was thinking if it was possible to just set something like http://labdb/ to redirect to the database that would be awesome, unfortunately I don't know how to do this.

Any suggestions?
Old 07-21-2005, 07:45 PM   #2
Senior Member
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
first of all you may change the root directory in http.conf:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot "/var/www/htdocs"
To /var/www/htdocs/subdir for example

or since you use php, you may use something like this:
header("Location: /some/subdirectory/index.php");
in the main page.

P.S. I don't like web programming and I'm not good at. It's just the first thing that crossed my mind when I read your thread. So I don't know if this is the best solution, but I cannot think of any reason why this wouldn't work.
Old 07-21-2005, 08:37 PM   #3
Registered: Jul 2001
Distribution: Ubuntu
Posts: 195

Original Poster
Rep: Reputation: 30
Unfortunately Mac OS X is setup a specific way, and it is very difficult to change global settings like least if I understand you right.

The other thing is that I don't want to change the entire server structure, I just want to have a local URL that is really short, but redirects to a certain location. I know there are things like virtual server settings which are kinda like what I want to do, but they seem overly complicated for something that seems like it should be easy to do.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
So many errors when I typed the "make" and "make install" command Niceman2005 Linux - Software 23 07-22-2009 03:33 PM
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 05:51 AM
[Redhat] make "admin" account same privledges as "root" Bi0haZarD Linux - Networking 20 01-12-2005 11:47 AM
Can't make Apache display anything diferent than the "test page" johann519 Linux - Networking 7 01-21-2004 07:54 PM
LFS 4.1: Stalled at Perl, "missing seperator" error from "make" SparceMatrix Linux From Scratch 1 06-07-2003 04:31 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration