Jump to content

Recommended Posts

I've been successful in redirecting all subdomains to a single file folder on my server but I can't seem to avoid the url from being rewritten during redirection.  The solution as I'm told is to enable and configure mod_proxy and that is where I need your help.

 

 

 


  • First, I enabled wildcard dns to work with any subdomain. Essentially any subdomain will lead to my domain...
     

*.example.com -> www.example.com

 

 

 

  • Next, I successfully wrote the following code to redirect all wildcard subdomains to app.example.com (the single file folder discussed above).  The idea is for my clients to have their own unique subdomain which will identify them when they use an application located at app.example.com.  So we want to load app.example.com but keep the client subdomain (*.example.com) in the address bar for appearances.  Again, this code successfully loads app.example.com from any subdomain at example.com...but it does not keep the original url which is the basis for having the client subdomains available to the application.

<VirtualHost 200.35.146.193:80>
ServerName app.example.com:80
ServerAlias *.example.com
DocumentRoot /var/www/vhosts/example.com/subdomains/app/httpdocs
</VirtualHost>

 

 

 

  • Here is where I need help.  I installed and loaded the mod_proxy module and attempted to configure it for access on example.com.  Again, I'm doing this to protect my client url from being overwritten with app.example.com while redirecting.  What happens is the proxy server does not allow the redirect to app.example.com...it prompts me to download the page it should redirect to - AS A FILE - instead of actually displaying it in the browser.  I've attached a screenshot showing the strange file download below.  Here is the code that isn't working...

<IfModule mod_proxy.c>
ProxyRequests On
ProxyVia On

<Proxy *:80>
    Order deny,allow
    Deny from all
    Allow from *.example.com
</Proxy>

</IfModule>


 

screenshot.jpg

Your help is greatly appreciated and needed :)

 

Thanks in advance.

 

Mike

Link to comment
https://forums.phpfreaks.com/topic/106734-virtual-subdomains-with-apache/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.