我正在尝试创建一个可以创建其投资组合的网站,目前曾创建过具有网址domain.com/content/username
的网页,但我想为每个用户username.domain.com
创建一个子网域。你知道怎么做吗?我试过这个:
Options +FollowSymLinks -Multiviews
RewriteEngine on
RewriteBase /
#
# Canonicalize the hostname
RewriteCond www.%{HTTP_HOST} ^(www)\.(mine-app\.fr) [OR]
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.(mine-app\.fr) [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.(mine-app\.fr) [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.(mine-app\.fr). [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.(mine-app\.fr):[0-9]+
RewriteRule (.*) http://%1.%2/$1 [R=301,L]
#
# If subdomain is NOT www
RewriteCond %{HTTP_HOST} !^www\.mine-app\.fr [NC]
# Extract (required) subdomain to %1
RewriteCond %{HTTP_HOST} ^([^.]+)\.mine-app\.fr$
# Rewrite if requested URL resolves to existing file or subdirectory in /content/<content>/ path
RewriteCond %{DOCUMENT_ROOT}/content/%1/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/content/%1/$1 -d
RewriteRule (.*) /content/%1/$1 [L]
但没有任何效果。我该如何解决这个问题?