Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Content Migration - Redirect URL with same hostname

sivas13911460
Level 1
Level 1

Hi All,

 

We are migrating content from one server to other server with below requirement.

1. We have two sites:

www.sitea.com/home/<pagename>.html

www.siteb.com/store/<pagename>.html

 

Content structure on Server A :  /content/siteA/home/*

Site name is :   www.sitea.com/home/abc.html

 

Content structure on Server B :  /content/siteB/store/*

 

Now we are planning to move some of the content  pages from Server A  "/content/siteA/home/*"  to Server B under store "/content/siteB/store/*". but we want to keep the url is same.

 

For example: we have page called 'abc' under /content/siteA/home/abc on Server A and this 'abc' page will be moved to server B under '/content/siteB/store/abc

Current URL of page is ' www.sitea.com/home/abc.html' so we want to keep the url remains same even though we move the page to Server B. Is this possible by writing some dispatcher rules? Please advise.

 

 

 

 

 

1 Accepted Solution
Andrei_Dantsou
Correct answer by
Level 4
Level 4

Hello @sivas13911460,

You can use either the RewriteRule directive with the P flag (https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_p) or the ProxyPass directive (https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass).
The ProxyPass, however, is preferable from the performance point of view. 

Regards

View solution in original post

4 Replies
Andrei_Dantsou
Correct answer by
Level 4
Level 4

Hello @sivas13911460,

You can use either the RewriteRule directive with the P flag (https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_p) or the ProxyPass directive (https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass).
The ProxyPass, however, is preferable from the performance point of view. 

Regards

View solution in original post

sivas13911460
Level 1
Level 1

Hi Andrei,

 

I've added below in my virtual hosts:
ProxyPreserveHost Off
ProxyPass "/store/" "www.siteb.com/home/"
ProxyPassReverse "/store/" "www.siteb.com/home/"

 

and when i hit the page : www.sitea.com/store/abc.html  it says:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Andrei_Dantsou
Level 4
Level 4

Hi @sivas13911460,

The exact path should be used with the ProxyPass:

 

ProxyPass "/store/abc.html" "http://www.siteb.com/home/abc.html" 

 


Alternatively, if a regex is required, then the ProxyPassMatch directive should be considered https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassmatch

Regards