Most virtual hosts cannot modify the root directory of a Web site. Can be achieved through. htaccess.
Apache host general support. Htaccess pseudo-static, that can be implemented to bind the domain name to subdirectories, a space multiple sites.
Application Example: Binding www.xxx.com to htaccess directory
root directory. htaccess content
<ifmodule mod_rewrite.c>/# binding www.xxx.com to subdirectories htaccessrewritecond%{http_host} ^ %{request_uri}!^/htaccess/^ (. *) $ htaccess/$1? Rewrite [L,QSA]# can be bound to multiple, just repeat the three lines of code and change the domain name, directory name on the line </IfModule>
. htaccess content in the htaccess directory
<ifmodule mod_rewrite.c>/# bind only domain access, other domain 301 jump rewritecond%{http_host}!^www\ . xxx\.com$ [Nc]rewriterule (. *) http://www.xxx.com/$1 [l,r=301]# processing of htaccess directories under the binding directory Rewritecond%{request_uri} ^\/ htaccess\/%{query_string}!^ (. *)? Rewrite#Rewriterule ^ (. *) $/%{request_uri}/%{request_uri}/$1? Rewrite [L,QSA]</IfModule>
If the requirements for a bound subdirectory are not high, the. htaccess file does not need to be established under the subdirectory.
How a virtual host binds to a subdirectory in a Web site root directory