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
-
x00 MVP
Have you over-ridden Anchor, UserAnchor, UserUrl, RegisterUrl, SigninUrl, SignoutUrl, etc? You are not going to catch everything. You may have redirect some, you can in parallel copy some views to theme. You could implement your own versions of modules.
Obviously vanilla hasn't has as long development history as wordpress, but even in wordpress it is not perfect.
You can fork anything, but it is your project to maintain. application in garden work in parallel. A lot of things are under dashboard application, or could be under core.
grep is your friend.
5
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.
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.
Have you over-ridden Anchor, UserAnchor, UserUrl, RegisterUrl, SigninUrl, SignoutUrl, etc? You are not going to catch everything. You may have redirect some, you can in parallel copy some views to theme. You could implement your own versions of modules.
Obviously vanilla hasn't has as long development history as wordpress, but even in wordpress it is not perfect.
You can fork anything, but it is your project to maintain. application in garden work in parallel. A lot of things are under dashboard application, or could be under core.
grep is your friend.