views:

672

answers:

3

Any recommendations or best practices for mapping a subdomain to a Wordpress page:

http://my-page.mydomain.com -> http://mydomain.com/my-page

I don't want to do a redirect either, just keep the original subdomain URL until a different link is click, and then the subdomain is removed.

I'm using Apache 2 with mod_rewrite, wordpress 2.7 with pretty-urls, and php 5.

+1  A: 

URL Rewriting. I would start here

NTulip
A: 

What you want can be achieved with mod_rewrite.

Keep in mind that google will detect the two pages as duplicates, which may hurt your pagerank.

Alphager
+1  A: 

As already mentioned I would use mod_rewrite to get this done. Something like the following should work in the my-page.mydomain.com virtual host

  RewriteEngine on
  RewriteRule (.*)  http://mydomain.com/my-page$1 [P,L]

This will require you to enable mod_proxy. Please read the security implications of doing this on the Apache website http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

neomorphic