RewriteEngine on
RewriteCond %{HTTP_HOST} ^space[0-9]+\.主机名$
RewriteRule ^/?$ /%{HTTP_HOST}
RewriteRule ^/space([0-9]+)\.主机名/?$ /home.php?h=$1 [L]
RewriteRule ^/blog\.主机名/([0-9]+)/([0-9]+)$ /home.php?h=$1&app=blog&id=$2 [L]
RewriteRule ^/photo\.主机名/([0-9]+)/([0-9]+)/([0-9]+)$ /home.php?h=$1&app=photo&photo_id=$2&album_id=$3 [L]