Forum Moderators: phranque

Message Too Old, No Replies

Yet another mod_rewrite problem

How to redirect different domains to different folders

         

shaharofir

8:36 am on Jul 28, 2004 (gmt 0)



Hi all, happy to find this forum.
I'm running my own server,Apache2,PHP5,MySql. I've registred to a dynamic ip service, which I'm updating upon ip change.

I have 2 registred domains who point to the same IP:
[plugab.example.com...]
[pitzka.example.com...]

I would like to redirect the second one to a folder /gallery, for example, and leave the first one untouched.
How can it be done? I've tried many mod_rewrite options, yet all has failed and I get 500 error.
10x in advance, hope I can help you with anything

*Edit*

I've managed to do so using javascript that looks like that:
<script language="JavaScript">
<!--
if( -1 == location.href.
toLowerCase().
indexOf('plugab.example.com') )
{
location.href =
'http://pitzka.example.com/pitzka/gallery/index.php';
}

will reffer all to the gallery unless address is plugab. Thats working, yet I have a feeling it should be done using mod_rewrite...

[edited by: jdMorgan at 2:57 pm (utc) on July 28, 2004]
[edit reason] Removed specifics per TOS [/edit]

jdMorgan

3:03 pm on Jul 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



shaharofir,

Welcome to WebmasterWorld [webmasterworld.com]!

> I've tried many mod_rewrite options, yet all has failed and I get 500 error.

Please post one of your mod_rewrite examples for discussion. Alternatively, you can search WebmasterWorld for phrases such as "subdomain subdirectory rewriterule".

Our forum charter [webmasterworld.com] contains information about this forum and a few links to resources to get you started.

Jim