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
Solved

Apache2 Mass Hosting

Posted on 2004-04-12
3
316 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ubuntu 14 with Apache 7 78
LINUX CENTOS + APACHE 9 70
Why Xampp showing MySQL as Maria DB on Welcome Page ? 8 89
Create link to folder for use with apache. 7 29
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…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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