0

I have been looking for an answer this without any luck (searched everywhere)

Basically, I want to rewrite a page (subfolder) to a new domain without changing the url.

I've tried with no luck:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/test/
RewriteRule ^(.*) http://newdomain/$1 [P] 

I have had a look at the "duplicate" question and it doesn't answer.

It does not explain how to rewrite a page to a new domain without changing the url.

Froggiz
  • 3,043
  • 1
  • 19
  • 30
testmaster
  • 1
  • 1
  • 2
  • 1
    possible duplicate of [Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod\_Rewrite Rules but Were Afraid to Ask](http://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever) – BE77Y May 14 '15 at 10:04

2 Answers2

1

Proxy Pass might be what you are looking for. It will use the url that they connected to, and act as a proxy to the new url. They will still see the old url.

ProxyVia on
ProxyRequests Off
ProxyPreserveHost Off

ProxyPass /test http://newdomain/test
ProxyPassReverse /test http://newdomain/test
grag42
  • 431
  • 2
  • 5
0

RewriteEngine On RewriteBase / RewriteRule ^test/(.*)$ http://newdomain/$1 [P,L]

the above rule will redirect all /test/... to backend without modifying the browser URL

serverliving.com
  • 885
  • 7
  • 15