# 使用 Discourse SSO 与 Mediawiki

**URL:** <https://meta.discourse.org/t/use-discourse-sso-with-mediawiki/69218>\
**Category:** Administrators\
**Tags:** sso, how-to\
**Created:** [2017 年9 月 1 日 16:57 UTC](https://meta.discourse.org/t/use-discourse-sso-with-mediawiki/69218 "2017-09-01T16:57:44Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

作者： ![SXX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sxx/32/119649_2.png) [@SXX](https://meta.discourse.org/u/SXX)\
发布日期： [2018 年6 月 27 日 23:35 UTC](https://meta.discourse.org/t/use-discourse-sso-with-mediawiki/69218/9 "2018-06-27T23:35:20Z")

</div>

I suppose it’s impossible to update OP with my current permissions so I’ll just share some useful details here.

So it’s end up Mediawiki actually using localized identifiers for special page URLs so redirect isn’t really an option once there is non-English UTF-8 in URL. Browsers tend to encode URLs and it’s tricky to make redirection work with either Nginx or Apache configuration.

So instead of adding redirect it’s possible to just hardcode url within Mediawiki in this file:

```plaintext
./includes/skins/SkinTemplate.php

```

Find (line 682 in my version):

```plaintext
                        $login_url = [
                                'text' => $this->msg( $loginlink )->text(),
                                'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
                                'active' => $title->isSpecial( 'Userlogin' )
                                        || $title->isSpecial( 'CreateAccount' ) && $useCombinedLoginLink,
                        ];

```

Then get it to look like this:

```plaintext
                        $login_url = [
                                'text' => $this->msg( $loginlink )->text(),
                                'href' => '/discourse-sso.php',
// 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
                                'active' => $title->isSpecial( 'Userlogin' )
                                        || $title->isSpecial( 'CreateAccount' ) && $useCombinedLoginLink,
                        ];

```

---

_[View the full topic](https://meta.discourse.org/t/use-discourse-sso-with-mediawiki/69218)._
