Welcome to Dream.In.Code
Become an Expert!

Join 137,208 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,293 people online right now. Registration is fast and FREE... Join Now!




Apache header Redirection

 
Reply to this topicStart new topic

Apache header Redirection, Like iis.

kyrotomia
16 Jul, 2008 - 05:55 AM
Post #1

D.I.C Head
**

Joined: 5 May, 2007
Posts: 50



Thanked: 1 times
My Contributions
Hi.
First, let me explain what I am trying to achieve :
I have 3 internal website. I would like to access them via their own dns records.
Like the following :
http://site1 -­> goes to site 1
http://site2 -­> goes to site 2
http://site3 -­> goes to site 3

My webserver is apache 2 running on a linux box and my DNS is a windows 2003 service.
So far, my dns records does the following :
site1 , site2, site3 all redirect to the linux box, so the following happens :
http://site1 -> http://site1/apache2-default/
http://site2 -> http://site2/apache2-default/
http://site3 -> http://site3/apache2-default/

What I would need :
http://site1 -> http://site1/apache2-default/site1
http://site2 -> http://site2/apache2-default/site2
http://site3 -> http://site3/apache2-default/site3

I don't care about url rewritting (like seeing only http://site1 instead of http://site1/apache2-default/site1).

I know how to achieve such things in IIS (using defined host header value per website), but I have no clue on how to achieve this in apache. I usualy answer most of my questions by using google, but this time I really can't put my finger on it crazy.gif .

Thank you for any help you can give me icon_up.gif
User is offlineProfile CardPM
+Quote Post

Deomitrus
RE: Apache Header Redirection
1 Aug, 2008 - 08:16 PM
Post #2

New D.I.C Head
*

Joined: 6 Jul, 2008
Posts: 23


My Contributions
You will need to edit the apache config file.
What you are looking for is called, 'virtualhosts'

Example code looks like:

CODE
NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
   DocumentRoot "C:\My Sites\Site1"
   ServerName site1.local
</VirtualHost>

<VirtualHost 127.0.0.1>
   DocumentRoot "C:\My Sites\Site2"
   ServerName site2.local
</VirtualHost>


Okay, so this is the default. It is very customizable. Usually you say, "IP 192.168.1.100 goes to www.site1.com" But I think you can also do addresses. I've gotten this to work with dynamic dns where I couldn't rely on a static IP address.

I'm a little tired, so I can't give you the whole scoop. But just Google search for 'apache virtualhosts' and you will find some good information and tutorials.

Hope this helps.


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 12:59PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month