# Redirect HTTP to HTTPS and maintain original URL

**URL:** <https://community.a10networks.com/t/redirect-http-to-https-and-maintain-original-url/85>\
**Category:** aFleX\
**Created:** [November 12, 2010, 12:57am UTC](https://community.a10networks.com/t/redirect-http-to-https-and-maintain-original-url/85 "2010-11-12T00:57:37Z")\
**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:** [November 12, 2010, 12:57am UTC](https://community.a10networks.com/t/redirect-http-to-https-and-maintain-original-url/85/1 "2010-11-12T00:57:37Z")

</div>

**Posted by kberton**

If you have a need to redirect all incoming HTTP requests to a Vport to HTTPS _and_ also maintain the original URL info, then it can be done easily using aFlex.

#redirect to HTTPS #maintain original host and uri

when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

---

<div class="post-metadata">

**Author:** ![dmcdonald](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dmcdonald](https://community.a10networks.com/u/dmcdonald)\
**Post date:** [July 23, 2014, 5:53pm UTC](https://community.a10networks.com/t/redirect-http-to-https-and-maintain-original-url/85/2 "2014-07-23T17:53:46Z")

</div>

I found that I had to remove the quotation marks for this to work properly:

#redirect to HTTPS  
#maintain original host and uri

```auto
when HTTP\_REQUEST \{
HTTP::redirect https://[HTTP::host][HTTP::uri]
\}

```

---

<div class="post-metadata">

**Author:** ![dshin](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@dshin](https://community.a10networks.com/u/dshin)\
**Post date:** [July 30, 2014, 6:17pm UTC](https://community.a10networks.com/t/redirect-http-to-https-and-maintain-original-url/85/3 "2014-07-30T18:17:56Z")

</div>

Keep in mind that pre canned redirect(commonly used) aFlex scripts are also available on the ACOS under Config\>SLB\>aFleX\> 1. redirect1 2. redirect2 3. redirect\_rewrite

Genard
