# Rediriger la catégorie vers une URL externe

**URL:** <https://meta.discourse.org/t/redirect-category-to-external-url/85691>\
**Category:** Support\
**Created:** [Avril 19, 2018, 5:32 UTC](https://meta.discourse.org/t/redirect-category-to-external-url/85691 "2018-04-19T05:32:29Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Flower\_Child](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/flower_child/32/94987_2.png) [@Flower\_Child](https://meta.discourse.org/u/Flower_Child)\
**Post date:** [Avril 20, 2018, 6:21 UTC](https://meta.discourse.org/t/redirect-category-to-external-url/85691/9 "2018-04-20T06:21:16Z")

</div>

if you wanted a redirect this is the way to do it

```plaintext
api.onPageChange((url) => {
	if (url.includes('/c/redirect-politifora')) {
		window.location.replace('https://politifora.com/');
	}
});

```

however this is kinda slow and won’t run until the page has finished loading, which means users will still see the redirect category. i tried a second way, which is using jQuery to replace the _links_ on the index or anywhere else this category appears.

```plaintext
api.onPageChange(() => {
  $(function(){
    $('a[href*="/c/redirect-politifora').attr(
      'href', 'https://politifora.com/'
    ); 
  });
});

```

with this you don’t need a redirect, because it modifies href attribute of every redirect-politiflora link in place.

---

_[View the full topic](https://meta.discourse.org/t/redirect-category-to-external-url/85691)._
