NYCPHP Meetup

NYPHP.org

[nycphp-talk] Subdomain mod_rewrite

Dan Cech dcech at phpwerx.net
Fri May 9 16:56:04 EDT 2008


Hans Zaunere wrote:
> The ever fashionable mod_rewrite is throwing me for a loop.  Here's the
> scenario:
> 
> http://something.domain.com -> rewrite -> http://www.domain.com/something
> 
> Any pointers/examples on how to do this with mod_rewrite?

You may want to try something like:

RewriteCond %{SERVER_NAME} ^(something)\.domain\.com
RewriteRule ^/(.*) http://www.domain.com/%1/$1 [R]

Dan



More information about the talk mailing list