anandimhere

Registered
Dec 4, 2012
2
0
1
cPanel Access Level
Website Owner
hi,

i want to redirect domainA.com to https://subdomain.domainB.com .
Redirection is success with code below

RewriteEngine On
RewriteCond %{HTTP_HOST} ^uophp.com
RewriteRule (.*) https://subdomain.domainB.com/$1 [L]

But when i try with below codes with flag [P] so that url doesnt get changed then it gives me 500 error

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domainA.com
RewriteRule (.*) https://subdomain.domainB.com/$1 [P]

i have checked proxy_module is loaded in apache ..
Getting out of cloue. Any help will be appreciated
 
Last edited by a moderator:

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,261
313
Houston
I don't think this functions this way - you need to declare the proxy URL - RewriteRule Flags - Apache HTTP Server Version 2.4

https://searchengineland.com/url-rewrites-and-redirects-part2-16575 said:
Let’s say you wanted to rewrite to a URL located on another server. You can do it with the [P] flag. The “P” stands for “proxy”. For example, you could proxy the Google home page on your server (sans images) with the following rewrite rule:

RewriteRule /google\.html$ http://www.google.com/ [P,L]

Without the [P] flag, the rewrite rule above would behave like a redirect.