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.
Easy ways to change the URL from /discussion/?
Currently, the URL to a discussion is as the format of:
It works well for generic discussion purposes. However, as I am using Vanilla 2 for a slightly different purpose (more towards Classified Ads as a matter of fact), the URL isn't very desirable for me for SEO purposes.
I actually wanted it to be of something like:
I thought of two ways that I could possibly change it. First, by renaming the Controllers/Modules and force it to load with a different name. A second way would be via modifying the default .htaccess and somehow map /item/ onto /discussion/ instead. Not sure if both are possible as I have not done my fair share of probing yet.
Just wondering if there could be a third and easier way? I thought Routes might be relevant but I couldn't find more information about how to use it.
Any suggestions are welcomed.
http://vanillaforums.org/discussion/11013/post-discussion-button
It works well for generic discussion purposes. However, as I am using Vanilla 2 for a slightly different purpose (more towards Classified Ads as a matter of fact), the URL isn't very desirable for me for SEO purposes.
I actually wanted it to be of something like:
http://domain.com/item/11013/dell-laptop
I thought of two ways that I could possibly change it. First, by renaming the Controllers/Modules and force it to load with a different name. A second way would be via modifying the default .htaccess and somehow map /item/ onto /discussion/ instead. Not sure if both are possible as I have not done my fair share of probing yet.
Just wondering if there could be a third and easier way? I thought Routes might be relevant but I couldn't find more information about how to use it.
Any suggestions are welcomed.
0
Comments
I messed around for about an hour with a plugin that would do some of this and decided that it would be *possible* but not *easy*, if that makes any sense. The real issue is that even though its quite simple to make a call to /item/ trigger the DiscussionController, its much more complex to replace all the hyperlinks in the view so that they too point to /item/ and not /discussion/.
I think your best bet in terms of value for your time would be to use .htaccess to translate /item/ into /discussion/ and then just live with the fact that the links are still going to point to /discussion/ until they're clicked.
Vanilla Forums COO [GitHub, Twitter, About.me]
@Mark just tagging you here to see what your views on routing with the anchor tag obeying routes too if they apply.
item/:num/:alphanum
->discussion/$1/$2
anditem/:num
->discussion/$1
then, in applications/vanilla/views/* replace all instances of
/discussion/'.$Discussion->DiscussionID
with/item/'.$Discussion->DiscussionID
(should be in like 3 or 4 files)(we need like an inline code tag or something)
@NickE I don't understand the routing bits. Am I supposed to set it up in the Dashboard or are they parameters for .htaccess?
@Mark I was just wondering, wouldn't it be better for the URL to be in these formats?
domain.com/[categoryname]
domain.com/[categoryname]/[id]/[discussionname]
instead of
domain.com/category/[categoryname]
domain.com/discussion/[id]/[discussionname]
I mean it would be easy for end users to just configure accordingly in the Category Settings and there is no need to delve into Anchor or Reverse Routing, which sounds very complicated to me. Plus I think the SEO of the new URLs would be much better too.
@garymardell Maybe SEO isn't the strong point here. But the thing is, allowing the URL to be customizable would make Vanilla a lot more versatile as a multi-purpose platform. I was just reading on another discussion here in which the author wanted to build a dating website based on Vanilla. And my application of Vanilla is not exactly as a forum too. Why restrict such a wonderful platform to just forums when it could truly blossom as just anything with such a simple change?
The URL code is already built-in, so it's really just about allowing the category's URL code to be fully utilized.
I understand that it is possible to customize the URL right now by going through the files, but from a end-user who is not very technical's (which on an average case is about 80% of the population) standpoint, to be able to just configure everything in the Admin Panel is a superb feature.
Anyway just my 2 cents.
Given that I can now set up categories in the format that I suggested:
domain.com/categoryname
domain.com/categoryname/id/discussionname
I can now create a category called blog, and I can change the entire display of the category in my theme, and make it looks like an actual blog. I can create a category called page, and it too can look very different from the rest of the categories.
And these can be done under Themes by setting conditional checks, which is great for users who are not as highly technical as most of you here are. Although Applications is itself designed for such multi-purpose, customizing Applications would be out of league for a lot of users.
Anyway I do understand what some of the limitations are, like how the way modules and themes are related to each other via URLs would probably be a major problem. Still would be great if my idea can be tweaked somewhat into a workable model.
I am curious about the method you use. Right now if i want to achieve such i would have to manually search and replace all instances in the core files. I am wondering if there is a better way as I do not understand and trust the other methods yet. thanks.