mod rewrite - Apache dynamic subfolders -
i need setup apache deals 2 different disk locations , maps different sites dinamically based on subfolder on urls:
http://localhost1/site1.com/ http://localhost1/site2.com/ http://localhost2/site3.com/ ...
that map respectively to:
c:\folderone\site1.com\public_html c:\folderone\site2.com\public_html c:\foldertwo\site3.com\public_html ...
i've found examples use mod_vhost_alias, mod_alias , mod_rewrite different things, have not been able implement need.
thanks.
to redirect sites dynamically, try following:
in apache's sites-available folder, should have file called 000-deafult.conf, or similar. need edit file redirecting.
however, way can redirect sub folder dynamically if domain have indicates subfolder use, sort domains according tld's.
therefore suggest like:
usecanonicalname off <virtualhost *:80> servername vhosts.fqdn serveralias www.*.com virtualdocumentroot /c/com/%2/public_html </virtualhost> <virtualhost *:80> servername vhosts.fqdn serveralias *.com virtualdocumentroot /c/com/%1/public_html </virtualhost> <virtualhost *:80> servername vhosts.fqdn serveralias www.*.net virtualdocumentroot /c/net/%2/public_html </virtualhost> <virtualhost *:80> servername vhosts.fqdn serveralias *.net virtualdocumentroot /c/net/%1/public_html </virtualhost>
and forth.
hope answers question.
Comments
Post a Comment