LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   make "localhost" point to a subdirectory of Apache server (https://www.linuxquestions.org/questions/linux-networking-3/make-localhost-point-to-a-subdirectory-of-apache-server-345524/)

oudent 07-21-2005 06:10 PM

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?

perfect_circle 07-21-2005 06:45 PM

first of all you may change the root directory in http.conf:
Code:

#
# 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:
Code:

<?php
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.

oudent 07-21-2005 07:37 PM

Unfortunately Mac OS X is setup a specific way, and it is very difficult to change global settings like that...at 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.


All times are GMT -5. The time now is 10:54 PM.