Solved

Apache2 Mass Hosting

Posted on 2004-04-12
3
317 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
3 Comments
 
LVL 10

Accepted Solution

by:
Mercantilum earned 500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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