homepage Welcome to WebmasterWorld Guest from 54.161.236.229
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
mod rewrite: distribution of domains on virtual host
globay




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

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




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

globay:

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

[webmasterworld.com...]

Jordan

jdMorgan




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

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




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

Jim,

thanks a lot! Thats exactly what I needed!

--
globay

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved