Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Removing the discussion name from URLs?


Currently our URLs are in the following format:

Due to some people reading the forum at work, they'd like for the discussion not to appear in the URL so that it's hidden from the IT department, so is there anyway to get the discussion looking like this?

When I go to that URL it works fine, so I think I just need to figure out how to change the URL that's being created :)



  • Options

    you can predefine DiscussionUrl

    Note this has other implications name SEO. if this is not important then fine.
    put this in conf/bootstrap.after.php (create the file)

    <?php if (!defined('APPLICATION')) exit();
    function DiscussionUrl($Discussion, $Page = '', $WithDomain = TRUE) {
       $Discussion = (object)$Discussion;
       //$Result = '/discussion/'.$Discussion->DiscussionID.'/'.Gdn_Format::Url($Discussion->Name);
       $Result = '/discussion/'.$Discussion->DiscussionID; //no slug
       if ($Page) {
          if ($Page > 1 || Gdn::Session()->UserID)
             $Result .= '/p'.$Page;
       return Url($Result, $WithDomain);

    it is not 100% full-proof, as some extension may still not use this function. But for browsing it shoudl work.

    Really if they are doing stuff they should do at work, they will likely get found out or the IT dept already knows about it.

    grep is your friend.

  • Options

    Ah! You're a star, thanks so much x00

Sign In or Register to comment.