Thread: Domain mapping
View Single Post
Old 02-21-2009, 08:37 PM   #6 (permalink)
trmbne2000
The Wanderer
 
Join Date: Nov 2007
Posts: 13
Thanks: 0
trmbne2000 is on a distinguished road
Default

All of their subdomains like username.wordpress.com are probably handled with wildcard dns (http://en.wikipedia.org/wiki/Wildcard_DNS_record). As far as being able to get www.username.com to map to your wordpress site, I don't know exactly what they do, but this solution may work as a workaround:

Use mod_rewrite to serve master.php in place of all html files, something like this:
Code:
RewriteEngine on
# Skip www.yourdomain.com
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule \.(css|jpe?g|gif|png)$ - [L]
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
RewriteRule ^www.([\w\.-]+\.[\w]{2,3})/(.*) master.php?domain=$1&args=$2
Then in master.php you would need to have some code to pull out the domain and other arguments passed in the rewritten url.

Hope that gets you started in the right direction.
trmbne2000 is offline  
Reply With Quote