# redirect-rewrite -http template

**URL:** <https://community.a10networks.com/t/redirect-rewrite-http-template/425>\
**Category:** ADC - Application Delivery\
**Created:** [January 20, 2017, 12:00am UTC](https://community.a10networks.com/t/redirect-rewrite-http-template/425 "2017-01-20T00:00:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/a10_community/original/1X/bb9f186d33804d3044a0374e589f49fdf3be1328.png) [@system](https://community.a10networks.com/u/system)\
**Post date:** [January 20, 2017, 12:00am UTC](https://community.a10networks.com/t/redirect-rewrite-http-template/425/1 "2017-01-20T00:00:17Z")

</div>

hi All,

Do any one has issues using rewrite redirect option in http template .

its pretty simple requirement any request with / need to redirect to /login.jsp

rewrite option i used was  
[https://abc.com/](https://abc.com/) ---- [https://abc.com/login.jsp](https://abc.com/login.jsp)  
and it never worked any help much appreciated .

```auto
FYI , im also using the same template to host switch i.e based on host headers select respective pool.

host switch ( configured as )

```

contains [abc.com](http://abc.com) service group pool1  
contains [xyz.com](http://xyz.com) service group pool2

---

<div class="post-metadata">

**Author:** ![siddharthaa](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@siddharthaa](https://community.a10networks.com/u/siddharthaa)\
**Post date:** [March 3, 2017, 2:53am UTC](https://community.a10networks.com/t/redirect-rewrite-http-template/425/2 "2017-03-03T02:53:52Z")

</div>

Hi

If you are terminating the SSL connection on the ADC, you can use aFleX to redirect the request.

Example: In my setup I was able to redirect [https://example.com/](https://example.com/) to [https://example.com/heartbeat.php](https://example.com/heartbeat.php) as follows:

```auto
when HTTP\_REQUEST \{
  if \{ ([HTTP::host] eq "example.com") and ([HTTP::uri] eq "/") \} \{

```

HTTP::redirect “[https://example.com/heartbeat.php](https://example.com/heartbeat.php)”

```auto
      \}
\}

You can customize this for your use-case.

```

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/a10_community/original/1X/bb9f186d33804d3044a0374e589f49fdf3be1328.png) [@system](https://community.a10networks.com/u/system)\
**Post date:** [March 3, 2017, 3:36pm UTC](https://community.a10networks.com/t/redirect-rewrite-http-template/425/3 "2017-03-03T15:36:05Z")

</div>

Hi Shiva,

Also for reference, there a subtle inference in the documentation for Host/URL switching that says you can only use either host switching or url switching in an http template…not both. So if you are using http template for host switching, then you’ll have to use the aflex provided to do url switching.

You can configure an HTTP template with **one** of the following service-group switching options: • URL switching – Selects a service group based on the URL path in the GET line of the HTTP request’s header • Host switching – Selects a service group based on the domain name in the Host field of the HTTP request’s header
