Welcome to WebmasterWorld Guest from 54.146.246.4

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod rewrite: distribution of domains on virtual host

     

globay

2:15 am on Aug 7, 2003 (gmt 0)

10+ Year Member



Here is what I want to do:

on a virtual server, I have the following domains:

d1.com, www.d1.com, d2.com, [...] that redirect to my root directory.

when a user types: d1.com/something they shoud be taken to: d1/index.php
when a user types: d2.com/someurl/asdf/ they shoud be taken to: d2/index.php

Formerly, I just had one domain where I used:

RewriteEngine On
RewriteRule .* d1/index.php [L]

Now, I need to modify this, so that I can use more than one domain.

Unfortunately, I couldn't find anything in Google. Thanks for your help!

--
globay

MonkeeSage

2:20 am on Aug 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



globay:

I think they came up with a solution similar to what you are looking for, here:

[webmasterworld.com...]

Jordan

jdMorgan

2:36 am on Aug 7, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



globay,

The linked thread above is for a different problem.

> when a user types: d1.com/something they shoud be taken to: d1/index.php
> when a user types: d2.com/someurl/asdf/ they shoud be taken to: d2/index.php
> Now, I need to modify this, so that I can use more than one domain.


RewriteCond %{HTTP_HOST} ^(www\.)?(.+)\.com [NC]
RewriteRule .* /%2/index.php [L]

(I assume you also want to redirect www.d1.com/<something> to /d1/index.php and www.d2.com/<something> to /d2/index.php. If not, delete the "(www\.)?" in the RewriteCond.)

Jim

globay

3:18 am on Aug 7, 2003 (gmt 0)

10+ Year Member



Jim,

thanks a lot! Thats exactly what I needed!

--
globay