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.

[ReSolved] Change /discussions/ url-name

MupetzMupetz New
edited August 2011 in Vanilla 2.0 - 2.8
Hello,
I would like to know which file and which line I need to modify to change the /discussions/ url-name.
Example :
http://www.domain.com/discussions/144/topic-name
to
http://www.domain.com/blabla/144/topic-name

Thank you
Tagged:

Comments

  • I believe this is possible, but would require a plugin. I know of no ability to do this in core without hacks.
  • This should be possible via the .htaccess URL rewriting. I'm not sure how otherwise, since the URL being passed to Vanilla has to have a certain format so that it knows it has to call the DiscussionController...
  • LincLinc Admin
    edited October 2010
    .htaccess would definitely be simpler.

    RewriteRule /discussion/(*) /whatever/$1 [R=301]
    RewriteRule /whatever/(*) /discussion/$1 [PT, L]
    See next post

    ^ My 10-second incomplete sketch of what the solution probably entails if it can be done at all (sorry, writing plugins at the moment). Don't paste that onto your live site :P
  • Thank you guys.
    Lincoln, that's even better with .htaccess :) but your Rules gives me the Internal Server Error.
    I'm with godaddy, the inconvenient, heh
    Do I have another chance ?
  • LincLinc Admin
    edited October 2010
    Rules were way wrong, haha. OK, after this line:
    RewriteEngine On
    Do this:
    RewriteRule ^discussion/(.*)$ /whatever/$1 [R,L] RewriteRule ^whatever(.*) index.php\?p=discussion$1 [PT,L]
    But substitute your new word in where I typed whatever.

    Note that this is a VERY SPECIFIC solution that only fixes the URL to individual discussions, not a comprehensive fix for language substitution. Also, this obviously only works when "pretty" URLs are enabled.
  • @Lincoln
    I tried your rules above and though the URLs are changing when I click on a discussion it just disappears instead of taking me to comments' page.
  • its work on vanilla 2.0.17.10.. Thanks for your solution..
  • Rules were way wrong, haha. OK, after this line:
    RewriteEngine On
    Do this:
    RewriteRule ^discussion/(.*)$ /whatever/$1 [R,L] RewriteRule ^whatever(.*) index.php\?p=discussion$1 [PT,L]
    But substitute your new word in where I typed whatever.

    Note that this is a VERY SPECIFIC solution that only fixes the URL to individual discussions, not a comprehensive fix for language substitution. Also, this obviously only works when "pretty" URLs are enabled.
    @Lincoln i tried it and it works perfect. but is it possible to modify this code for url structure like mydomain.com/whatever

    thanks
  • @ramesh So you have Vanilla installed in a subfolder named 'whatever'?
  • @ramesh So you have Vanilla installed in a subfolder named 'whatever'?
    No i want url structure like mydomain.com/post-name , just like i wordpress offers.

    e.g. http://vanillaforums.org/change-discussions-url-name#Item_9

    is it possible with .htaccess editing ?
  • LincLinc Admin
    edited August 2011
    You want to omit the discussion ID# as well? Doing that is a bit beyond what I'm willing to type out, because you're absolutely going to run into all sorts of conflicts with every other URL on your site.

    If you just want mydomain.com/123/discussion-name then you could do it by writing all URLs that start with a number to the discussions controller. I don't favor this change though because you're liable to run into conflicts between other Vanilla apps and future changes.
  • @lincoln thank you very much for your help . I convinced.
  • Has there been any progress on this? Though the .htaccess is a step in the right direction it doesn't solve the problem. We need something that would change the saving and output of the urls entierly.

  • ToddTodd Vanilla Staff

    We've made it easier to do this in the upcoming 2.1, but you'll still have to write a plugin.

Sign In or Register to comment.