# Redirect all users who click on domain.com/signup to a different page

**URL:** https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532
**Category:** Development
**Created:** [2월 14, 2018, 12:14오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532 "2018-02-14T12:14:23Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 14, 2018, 12:14오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/1 "2018-02-14T12:14:23Z")

</div>

I’m currently trying to redirect all potential new users to a landing page instead of having the modal show up. What would be the most elegant way to do this? If they sign up I would create their account via the API

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2월 14, 2018, 1:08오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/2 "2018-02-14T13:08:12Z")

</div>

You can use SSO login

> [@Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)](https://meta.discourse.org/t/official-single-sign-on-for-discourse-sso/13045):
>
> [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) is a core Discourse feature that allows you to configure “Single Sign-On (SSO)” to completely outsource all user registration and login from Discourse to another site. Offered to our [pro, business and enterprise hosting customers](https://discourse.org/pricing). information_source (Feb 2021) ‘[Discourse SSO](https://meta.discourse.org/t/13045?silent=true)’ is now ‘[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)’. If you are running an old version of Discourse, the settings below will be named sso\_... rather than discourse\_connect\_... The Problem Many sites wishing to integrate wit…

---

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 14, 2018, 1:19오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/3 "2018-02-14T13:19:17Z")

</div>

Right, but I feel that’s just too complicated. I simply want to just not have anything change on the site and simply redirect all those who want to sign up to a different page as I still want them to be able to log in and not have the css change or trying to add in another login button

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2월 14, 2018, 1:46오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/4 "2018-02-14T13:46:21Z")

</div>

No, you can’t do it without a plugin / theme customization.

---

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 14, 2018, 7:16오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/6 "2018-02-14T19:16:29Z")

</div>

If I was to make this a plugin could I do something like this, and not even need the javascript just with the plugin.rb?

```
# name: signup
# about: /signup plugin for Discourse
# version: 0.1
# authors: nadermx

after_initialize do
  Discourse::Application.routes.prepend do
    get 'signup' => '//newdomain.com'
  end
end

```

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2월 14, 2018, 7:24오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/7 "2018-02-14T19:24:10Z")

</div>

`Signup` button click won’t call server route to navigate like your plugin example. It will just display the ember popup in browser.

So you only need a custom signup link via theme customisation.

---

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 14, 2018, 7:27오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/8 "2018-02-14T19:27:21Z")

</div>

In permalinks? I tried setting up a permalink for signup to a extarnal link called [new.domain.com/](http://new.domain.com/) but it still just shows the sign up modal

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2월 14, 2018, 7:30오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/9 "2018-02-14T19:30:57Z")

</div>

When the signup button clicked nothing else will happen except displaying the popup. So you have to change the behaviour of the button or replace it with a link.

---

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 14, 2018, 7:32오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/10 "2018-02-14T19:32:18Z")

</div>

Right, I’m trying to replace all the /signup links on the button and in the login

I’m just confused as to what is the best way to do this? You suggested making a plugin, but now you are suggesting replace the link.

This is what I’m trying to do but still a bit confused

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [2월 14, 2018, 7:36오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/11 "2018-02-14T19:36:57Z")

</div>

I suggested you for plugin / theme customisation. It is possible in both ways. But creating a custom rails route won’t help.

---

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 15, 2018, 1:52오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/12 "2018-02-15T13:52:47Z")

</div>

Alright, I’m trying to edit the theme instead and have put this javascript in my `</head>` section

```
<script>
    document.getElementsByClassName(".sign-up-button").onclick = function () {
        console.log('this should print');
    };
</script>

```

But when ever I click it it does not show in the console.

I’ve also tried variations, it does show the element but no actions of the js are working on it such as

```
<script>
    var thingy = document.getElementsByClassName("sign-up-button");
    console.log(thingy);
    thingy.onclick ="return false;"
    thingy.onclick = function() {
        window.location.href = "https://join.example.com";
    };
    console.log(thingy);
</script>

```

---

<div class="post-metadata">

### Author: ![nadermx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nadermx/32/67585_2.png) [@nadermx](https://meta.discourse.org/u/nadermx)
#### Post date: [2월 15, 2018, 4:13오후 UTC](https://meta.discourse.org/t/redirect-all-users-who-click-on-domain-com-signup-to-a-different-page/80532/13 "2018-02-15T16:13:17Z")

</div>

I still can’t seem to get this to work as it seems even if I put the script in the `</body>` of the admin pane, it still always shows the length as 0 of the html collection. I suppose it’s because it’s firing before the document is fully loaded?

```
<script>
    var thingy = document.getElementsByClassName("sign-up-button");
    console.log(thingy.length)
    for (var i = 0; i < thingy.length; i++) {
            console.log('pring this');
    };
</script>

```

Any help would be apprecicated
