开发者

Mod Rewrite for Server Status 503, depending upon URL

开发者 https://www.devze.com 2023-04-04 19:14 出处:网络
I want to redirect only if there is an error (server status 503). Without the error, this is the redirect script, which works fine:

I want to redirect only if there is an error (server status 503). Without the error, this is the redirect script, which works fine:

Redirect /abc https://www.abc.com/pqr.html
Redirect /cde https://www.cde.com/pqr.html

But, this redirects /a开发者_Python百科bc to https:// www.abc.com/pqr.html in all cases. I want this redirect only in case of an error. This syntax:

ErrorDocument 503 https://www.abc.com/pqr.html

redirects all urls with 503 error message to https:// www.abc.com/pqr.html. But, I want the /cde ones with 503 error messages to be redirected to https:// www.cde.com/pqr.html

Any clues on how to do it?


This perfectly works for me. Got this answer in Apache Forums:

<VirtualHost x.x.x.x:80>
   ServerName www.mysite.com
   <Location /books>
           ErrorDocument 503 http://www.mypartnersite.com/books
   </Location>
   <Location /music>
           ErrorDocument 503 http://www.mypartnersite.com/music
   </Location>
   ...
</VirtualHost>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号