Configuration apache with webroot and subdomains


I have this configuration of virtualhost.

<VirtualHost *:80>

RewriteEngine on
RewriteRule		^/		-			[E=IP:%{REMOTE_ADDR}]
RequestHeader set       X_REMOTE_ADDR   %{IP}e

RewriteCond		%{HTTP_HOST}
RewriteRule		^/(.*)$$1	[R=301,L]

RewriteCond		%{HTTP_HOST}
RewriteRule		^/		http://web-example:9020/subdomain1	[P]

RewriteCond		%{HTTP_HOST}
RewriteRule		^/		http://web-example:9020/subdomain2	[P]

ProxyPass		/		http://web-example:9020/ retry=1
ProxyPassReverse	/		http://web-example:9020/

ErrorLog		log/example-web-error_log
CustomLog		log/example-web-access_log combined

and for server listen on port 9020 have rule:

RewriteRule ^.well-known/ - [L,QSA]

I need help with configuration apache for webroot on subdomain. When I connect to… without problem. Only with subdomain. I dont know how make rewriterule for subdomain.



why you set X_REMOTE_ADDR as Header? In the backend you can use X-Forwarded-For to get the IP address. :see_no_evil:

Is web-example:9020 on the same apache webserver?
How does the virtualhost configuration of that host looks then? Is the DocumentRoot on the same directory?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.