# Redirect Help to a subdomain

**URL:** <https://discourse.haproxy.org/t/redirect-help-to-a-subdomain/6320>\
**Category:** Help!\
**Created:** [March 4, 2021, 2:45pm UTC](https://discourse.haproxy.org/t/redirect-help-to-a-subdomain/6320 "2021-03-04T14:45:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![r2t2](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/r2t2/32/1406_2.png) [@r2t2](https://discourse.haproxy.org/u/r2t2)\
**Post date:** [March 4, 2021, 2:45pm UTC](https://discourse.haproxy.org/t/redirect-help-to-a-subdomain/6320/1 "2021-03-04T14:45:19Z")

</div>

We are moving our news articles from our main web site to a new blog sub domain. I’m trying to get the redirection to work in HAProxy, but having some issues. I’m running 1.5 on a CentOS 7 server. What I’m wanting to do is change  
[https://www.example.com/news/post/sample\_page](https://www.example.com/news/post/sample_page)  
to  
[https://blog.example.com/sample\_page](https://blog.example.com/sample_page)

Here’s what I’ve got so far.

acl newspage url\_beg /news/post/  
http-request redirect code 301 location [https://blog.example.com](https://blog.example.com)%[capture.req.uri] if newspage

But I need to strip out the /news/post part of the uri. That’s where I’m stuck.  
I’ve tried  
[capture.req.uri,regsub(^/news/post,)]  
but that just puts me at the root, it doesn’t preserve the specific page.

Thanks.
