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.

I need help changing vanilla routes

For some very important reasons that has to do with integration, I need to change the vanilla default discussion route from
siteurl.com/discussion/123/post-slug
to something like
siteurl.com/custom/123/post-plug
I have tried changing the routes from the dashboard->Routes (DefaultController and DefaultForumRoot), but when I change them, it breaks the forum.
Thanks.

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Welcome to the community!

    This seems like a terrible idea, but you can totally do it!

    1. Create an application
    2. Create a controller called CustomController where Custom is replaced by your path
    3. Make it extend the DiscussionController
    4. Rewrite your routes from discussion to custom

    Route: ^discussion(/.*)?$
    Target: custom/?$1

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Ok @hgtonight
    Why do you think its a terrible idea?
    How do I create an application?

  • peregrineperegrine MVP
    edited October 2015

    xm1 said: How do I create an application?

    in answer to this question....

    there was a document on creating vanilla applications and an example application. It was in the old user documentation.

    http://vanillaforums.org/discussion/22955/application-development-how-to

    Also, it may (or may not) be in the "latest" documentation. you could check the documentation link at the top of the page in the navigation menu.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • hgtonighthgtonight ∞ · New Moderator

    @xm1 said:
    Ok hgtonight
    Why do you think its a terrible idea?
    How do I create an application?

    I think it is a terrible idea because any plugin that writes URLs manually and/or extends the discussion controller might not work. I can't think of a really good reason to change the name of a controller excepting to translate the URL.

    There was a sample application bundled with Vanilla called skeleton that broke down what you could do. It isn't up to date, but there is some good information in there: https://github.com/vanilla/vanilla/tree/05e655647f3eb3f7a526dd73a8b4147d8698e5e3/applications

    Remember that Vanilla is just an application too.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • x00x00 MVP
    edited October 2015

    @hgtonight he wanted to root controller discussion. I already answer his question here:
    http://vanillaforums.org/discussion/comment/234590/#Comment_234590

    No need to create an application in this case. Not full proof but good enough.

    Explicitly routed frameworks are common nowadays, implicitly routed like vanilla less so. There is an argument for backwards compatible explicit routing in vanilla.

    In vanilla route=rewrite/redirect, however actual routes are fully reversible, the basis to which framework like django determine urls and map architecture.

    grep is your friend.

Sign In or Register to comment.