0
votes

I want to redirect subdomain1.domain.com to subdomain2.domain.com but without changing the addres in the address bar.

Is this possible via .htaccess? If not, what will be an alternative solution (I'm using cPanel)?

I don't want to use a proxy ([P])!!!

1
if you don't want to use [P] then, via htaccess, you can'tOussama Jilal
Why the downwote? Plese describe what's the problem with this question. @Yazmat: Thank you for you reply. I realized that I can't do this via .htaccess without proxy. Still looking for an alternative solution.Tamás Pap

1 Answers

1
votes

Unless the 2 subdomains share a document root (or one is in a subdirectory of the other), then you can't do it without a proxy of any kind, with a [P] in htaccess or setting up a reverse proxy using ProxyPass (note that both use mod_proxy). There's no alternative solution that's strictly apache. You could write a script to load the pages of the other subdomain and park it on the first subdomain, but that's proxying as well, you're better off just using mod_proxy or one of it's extensions (like mod_proxy_html), which handles internal url rewrites of redirect locations, and cookies. An example of a non-apache solution would be mounting one subdomain's document root into the other and using mod_rewrite.