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.

Custom URLs

Hi,
I'm starting a long term project based on vanilla and I need to localize/customize URLs.
e.g. example.com/myCustomText/1/title instead of example.com/discussion/1/title.

With the route feature inside vanilla I can only redirect simple URL like example.com/customURL to example.com/discussions.

Customizing .htaccess don't solve the problem because I need custom url inside pages too (vanilla generated links inside pages).

Can I change these behavior from a plugin or I need to change vanilla-core sources?

I really appreciate any help you can provide.

There was an error rendering this rich post.

Best Answer

Answers

  • You cannot do this easily. You could predefine Url, Anchor, etc, functions in conf/boostrap.before.php, you could then hook the dispatcher to resolve through a lookup, or use routes. It wouldn't get every single link, but developers are encouraged to use those functions. It is not advisable to mod the source, as it will be overwritten when you update.

    The real question is why would you want to? Generally speaking, it has the most logical structure. There is some argument over the order of the ID or slug, though the effect on SEO, is debatable, and certainly negligible. The other argument is localisation of controllers an methods. I can understand that better.

    It is certainly not a task for the the faint hearted ATM.

    grep is your friend.

  • lifeisfoolifeisfoo ✭✭✭

    Mainly localization of controllers.

    So there isn't a "centralizated" url management layer (like wordpress). I written my own Url function in bootstrap.before.php, but home page (discussions) contains many unaffected urls that are hardcoded (see class.discussioncontroller.php).

    My main question, before start using vanilla, is: can I fork only vanilla application or I need to change the entire platform? I have time constraints :(

    There was an error rendering this rich post.

Sign In or Register to comment.