Apache 通配符sub.domain.tld重定向到domain.tld/sub
我目前在apache上有一个通配符子域:Apache 通配符sub.domain.tld重定向到domain.tld/sub,apache,apache2,subdomain,wildcard-subdomain,Apache,Apache2,Subdomain,Wildcard Subdomain,我目前在apache上有一个通配符子域: <VirtualHost xxx.xxx.xxx.xxx:80> DocumentRoot /home/web/domaine.tld/www ServerName domaine.tld ServerAlias *.domaine.tld VirtualDocumentRoot /home/web/domaine.tld/%1 CustomLog /var/log/apache2/domaine.tl
<VirtualHost xxx.xxx.xxx.xxx:80>
DocumentRoot /home/web/domaine.tld/www
ServerName domaine.tld
ServerAlias *.domaine.tld
VirtualDocumentRoot /home/web/domaine.tld/%1
CustomLog /var/log/apache2/domaine.tld/access.log combined
ErrorLog /var/log/apache2/domaine.tld/error.log
</VirtualHost>
DocumentRoot/home/web/domaine.tld/www
ServerName域.tld
ServerAlias*.domaine.tld
VirtualDocumentRoot/home/web/domaine.tld/%1
CustomLog/var/log/apache2/domaine.tld/access.log组合
ErrorLog/var/log/apache2/domaine.tld/error.log
并且需要将任何子域(如sub.domain.tld)重定向到domain.tld您可以通过.htaccess使用重定向
Redirect http://sub.domain.tld http://domain.tld