wordpress - Virtual Host Subsites apache 2.4 -


i'm setting 2 wordpress sites. scenario there 2 wordpress installations, in folder var/www/domain/us , var/www/domain/eu. domain.com/us should default option when access site domain.com users access site through: domain.com/us or domain.com/eu

right setup virtual host is: (i don't have real domain name attached, ip address far)

<virtualhost *:80>  servername [ip-address]  serveralias [ip-address]  documentroot /var/www/domain/us  errorlog /var/www/html/domain.com/logs/error.log  customlog /var/www/html/domain.com/logs/access.log combined </virtualhost>   <virtualhost *:80>  servername [ip-address]/us  documentroot /var/www/domain/us  serveralias [ip-address]  errorlog /var/www/html/domain.com/logs/error.log  customlog /var/www/html/domain.com/logs/access.log combined </virtualhost>  <virtualhost *:80>  servername [ip-address]/eu  documentroot /var/www/domain/eu  serveralias [ip-address]  errorlog /var/www/html/domain.com/logs/error.log  customlog /var/www/html/domain.com/logs/access.log combined </virtualhost> 

i can access ip address primary virtual host, last 2 ip/us , ip/eu giving page not found.

what doing wrong?

servername interprets path part of hostname. server name can contain request scheme, hostname , port, not path. therefore first virtual host valid.

since on apache 2.4, can use conditional directives solve problem. in first virtual host add following, , remove other two:

<virtualhost *:80>  servername [ip-address]  serveralias [ip-address]  <if "%{request_uri} =~ m#^/eu.*$#">    documentroot /var/www/domain/eu  </if>  <else>    documentroot /var/www/domain/us  </else>  errorlog /var/www/html/domain.com/logs/error.log  customlog /var/www/html/domain.com/logs/access.log combined </virtualhost> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -