Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: rewrite ~userdir to subdomain |
|
Author |
|
blasto
Joined: 21 Mar 2006 Posts: 3
|
Posted: Wed 30 Sep '15 13:37 Post subject: rewrite ~userdir to subdomain |
|
|
Hi there,
I thought this would be an easy find but no luck so far...
I run apache to serve (with mod_userdir) micro user sites as:
portal.company.com/~user1
portal.company.com/~user2 ... so on
each user already has a virtualhost as user1.company.com pointing their home/www directory
So I would like portal.company.com/~user1 to be rewritten as user1.company.com
What is the proper way to use mod_rewrite in this case?
Thanks |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 07 Oct '15 13:40 Post subject: |
|
|
Very simple, just disable the mod-userdir, and add a ServerAlias
Code: | <VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/
</VirtualHost>
<VirtualHost *:80>
ServerName *.example.com
ServerAlias *.example.com
VirtualDocumentRoot /home/%1/www
</VirtualHost>
|
|
|
Back to top |
|
|
|
|
|
|