1

Please I need some help with Apache 2.4.18. This is the third day fighting with this problem.

Architecture

  • www.myserver.com: front server for traffic redirection

  • internal server with local ip 192.168.0.10 that contains 2 folders with one web app each one

    • 192.168.0.10/app01
    • 192.168.0.10/app02

I want to access these web apps through their subdomains

  • app01.myserver.com and
  • app02.myserver.com

This is my virtualhost configuration file

<VirtualHost *:80>
        ServerName app01.myserver.com
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://192.168.0.10/app01
        ProxyPassReverse / http://192.168.0.10/app01
</VirtualHost>

It's working but partially: traffic is being redirected but I'm having problems with links.

Problem

After login on app01.myserver.com the browser redirect to app01.myserver.com/dashboard, some links options on the app menu redirect to their respective modules but:

  • when I click app01.myserver.com/profile I'm redirected to app01.myserver.com/profile

  • then I'm redirected to app01.myserver.com/app01/profile

And it correctly gives me a 404 error because "app01/profile" doesn't exist.

I think I need a rewrite rule or the ProxyPass and ProxyPassReverse aren't right. Any help it will be appreciated.

2

Something like this should work for you:

RewriteEngine On

RewriteRule ^/app01/(.*)  http://app01.myserver.com/$1 [L]
RewriteRule ^/app02/(.*)  http://app02.myserver.com/$1 [L]
1
  • FTW!!!!! It works like a charm @Rainer! :D No more headache thanks!!!!!! – nerdcoder May 18 '17 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.