Title: http:// becomes http
Last modified: January 31, 2019

---

# http:// becomes http

 *  Resolved [maximmmus](https://wordpress.org/support/users/maximmmus/)
 * (@maximmmus)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/http-becomes-http/)
 * Hello,
 * I have added the code below to the functions file to create a redirect. The problem
   is that it converts `http://` to `http%3A%2F%2F` and the redirect fails. Do you
   have a fix for this? Thanks
 *     ```
       add_action( 'wpel_link', function ( $link ) {
           // check if link is an external links
           if ( $link->is_external() ) {
               // get current url
               $url = $link->get_attr( 'href' );
   
               // set redirect url
               $redirect_url = '//somedom.com?url='. urlencode( $url );
               $link->set_attr( 'href', $redirect_url );
           }
       }, 10, 1 );
       ```
   
    -  This topic was modified 7 years, 4 months ago by [maximmmus](https://wordpress.org/support/users/maximmmus/).

The topic ‘http:// becomes http’ is closed to new replies.

 * ![](https://ps.w.org/wp-external-links/assets/icon-256x256.png?rev=2103983)
 * [External Links - nofollow, noopener & new window](https://wordpress.org/plugins/wp-external-links/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-external-links/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-external-links/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-external-links/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-external-links/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-external-links/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [maximmmus](https://wordpress.org/support/users/maximmmus/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/http-becomes-http/)
 * Status: resolved