Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Apache2 Mass Hosting

Posted on 2004-04-12
3
Medium Priority
?
322 Views
Last Modified: 2012-08-13
The question is valued at 500 points and here is what I need:

I know that a really nice mass-hosting can be organised using mod_rewrite and here is what I need:
1. We've got a file (/etc/vhosts) with this structure:

site1.net                              /home/user2
supersite2.org                      /home/bobby
mysite.de                            /home/anythingelse

so we've got a map with corresponding home dir where we'll find the "docs" folder (that has htdocs meaning) and "cgi-bin"

We're not discussing any log files here

What I need is to configure the apache to:
1. if the request is http://mywebhost.com/users/user2 - then use /home/user2 (if it''s not found - show the default server page - not any vhost)
2. if the request is http://site1.net look for the match in the /etc/vhosts and use /home/user2 (use the default server page if not found)

So I'll need the example part of the httpd.conf that lets me do the things like that for apache2

Hope that it's clear, will clarify if needed
0
Comment
Question by:advert2k2p
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
Mercantilum earned 2000 total points
ID: 10853580
Using mod_rewrite

1. Ensure engine is on

RewriteEngine On

2. rule to actual users directories, e.g. user1, user2

RewriteRule  ^http://mywebhost.com/users/user1    http://site1.net   [L,R]    
RewriteRule  ^http://mywebhost.com/users/bobby   http://supersite2.org   [L,R]    

3. rule for other non existent users

RewriteRule  ^http://mywebhost.com/users/(.*)      http://mywebhost.com   [L]    

This should redirect user1 to site1.net, bobby to supersite2.org, and any other users/user to the home page (no redirect, same server).
The [L,R] means L: if match stop here (Last rule), R: redirect.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 11761061
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

    ACCEPT: Mercantilum

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Periwinkle
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question