Forum Moderators: phranque

Message Too Old, No Replies

Sub Domain Mod Rewrite

         

okgaz

8:38 am on Jul 24, 2007 (gmt 0)

10+ Year Member



I have 2 subdomains pointing to the same directory (since that is where the script they both use is) + I want them to show different pages.

sub1.domain.com/ to show page index1.php
and
sub2.domain.com/ to show page index2.php

Is it possible to write a mod rewrite rule for this?

-Gaz

jdMorgan

10:48 pm on Jul 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, use
 [url=http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond]RewriteCond[/url] %{HTTP_HOST} ^sub1\.example\.com 

to test the requested hostname and run a RewriteRule to map to the "sub1" index file.

Then once you get that working, do the same for sub2.

Jim