Redirect page/subfolder to new domain url without changing url in browser
5,633
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
Related videos on Youtube
Author by
testmaster
Updated on September 18, 2022Comments
-
testmaster over 1 year
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.
-
BE77Y almost 9 years
-
-
testmaster almost 9 yearsit gives me a 500 server error
-
testmaster almost 9 years<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^test/(.*)$ newdomain/$1 [P,L] </IfModule>
-
testmaster almost 9 yearsin addition, i want to point out that /test/ is simple a static page and it's 1 url that needs redirection to a whole new domain without changing the url
-
serverliving.com almost 9 yearsI forgot to mention that [P] flag is not allowed in htaccess files. You need to put this rule in the main apache virtual host configuration file.
-
testmaster almost 9 yearsive got it working but when it redirects to the new domain, the images break as it tries to look for the images on the old domain.