Score:0

Redirect root / to proxy alias multiple subdomains

cn flag

So I have been trying and failing at re-write conditions for a site that multiple subdomains for its site

The gist is that each market must direct and display code differently do to regulations

so

https://market1.product.com/    
https://market2.product.com/

Should redirect to

https://market1.product.com/product-alias
https://market2.product.com/product-alias

Same alias, different subdomains

So I have tried setting the proxypass and reverseproxy pass and various iterations of rewrite cond and rules like so

this was an attempt to make root just go to either of the subdomains

proxypass / https://market1.product.com/product-alias
proxypass / https://market2.product.com/product-alias

This gives me a Proxy 502 error

This was an attempt to capture the site and pass the site to the alias

RewriteCond %{HTTP_HOST} ^([^\.]+)\.product\.com
RewriteCond /product-alias
RewriteRule ^(.*) /%1/$1 [L]

This just puts the alias about 7 times after the site name

For context the biggest thing is I am more of developer for backend things so I tend to not mess with apache conf files but have the most experience amongst the group so I was voluntold to work with it, and all of this is most likely my lack of understanding of apache httpd and also not fully understanding the directives that come with mod_proxy and mod_rewrite

I hope this makes sense and follows all the rules and appreciate any feedback on the type of question and context I should add in the future, I am mostly a lurker and use the site throguh google searches of errors and not really an architect

in flag
ProxyPass is completely wrong in this context, it doesn't do redirects.
cn flag
Thanks for the reply, and info @GeraldSchneider i figured one of two or both were not the right choice. That answer has similar contexts and think i can combine my rewrites cond for subdomain with teh query string cond in that answer and make it work. My outage window for prodzone has closed so I will update with an answer tomorrow(yeah only env that have this set up is in stage and prod both are outage tickets.....enterprise Architecture for ya)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.