Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Friendly URLs

edited October 2006 in Vanilla 1.0 Help
2 questions 1. Is it possible to change the directory structure seen in the urls? /vanilla/discussions/ --> to --> /vanilla/topics/ /vanilla/discussion/ --> to --> /vanilla/topic/ 2. How can I remove the title from the url. The current way can cause duplicate content issues. /community/discussion/1/my-title-here/#Item_1 to /community/discussion/1/#Item_1

Comments

  • I think if you open up the .htaccess file in the root folder and change
    RewriteRule ^discussions/$ index.php [QSA,L]
    RewriteRule ^discussions/([0-9]+)/$ index.php?page=$1 [QSA,L]
    to
    RewriteRule ^topics/$ index.php [QSA,L]
    RewriteRule ^topics/([0-9]+)/$ index.php?page=$1 [QSA,L]

    and then add the following line to your conf/settings.php file (between the <? and ?> tags)
    $Configuration['REWRITE_index.php'] = 'topics/';

    It should take care of your first request (no guarantees though!). Unfortunately i dont have time to look into your second but i shouldnt be too difficult. I'll be back if noone else is.
  • In what files is some of this rewriting being done? I would like to look over the code to see what I can improve. I see most is in the .htaccess, but I don't see where it would be adding /my-title-here/ to the url in the htaccess. Also, the internal links have to be rewritten which would mean internal code writing those urls.
  • I've gotta have a guess at....the friendly urls extension file? :P Internal links are made in the appg/settings.php file but any changes you wish to make to that should be done by copying the necessary configuration lines into your conf/settings.php file (As i suggested)
  • BenBen
    edited October 2006
    You'd have to change the main .htaccess file, but you'd also have to add these to your conf/settings.php

    // Url Rewriting Definitions $Configuration['REWRITE_categories.php'] = 'categories/'; $Configuration['REWRITE_index.php'] = 'discussions/'; $Configuration['REWRITE_comments.php'] = 'discussion/'; $Configuration['REWRITE_search.php'] = 'search/'; $Configuration['REWRITE_account.php'] = 'account/'; $Configuration['REWRITE_settings.php'] = 'settings/'; $Configuration['REWRITE_post.php'] = 'post/'; $Configuration['REWRITE_people.php'] = 'people/'; $Configuration['REWRITE_extension.php'] = 'extension/';
    and obviously change them as needed.
  • You only really need add the ones you're planning on changing. Adding the rest is a little redundant. And removing the title from the url would need to be done in the extension code.
  • But there is no extension code in the download. The only thing in the extension download was a .htaccess file and a readme file. http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=30 Or are you speaking of a different file? If a different file can you please specify the exact file name and path in vanilla? I'm looking at the .htaccess and it shows all the rewrites but it does not apear to pass anything into the code to add the name at the end of the url. This tells me that somewhere in the default code that is dl'ed from vanilla it is adding the page title to the url. I just can't find out where.
  • I think I may have found the functions in Framework.Functions.php GetUrl Vanilla.Functions.php GetUnreadQuerystring & GetLastCommentQuerystring I'll have to play with them tonight to see what I can come up with. I am assuming there is no way to hook into these or overide them with a plugin? Will I be required to hack the base code? Thanks
  • My bad, I'd assumed the extension had some code of it's own. I dont think you should need to touch the GetUrl function cause that might break some other bits, bit just wiping:
    if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') $Suffix = CleanupString($Discussion->Name).'/';
    out of the 2 vanilla functions you mentioned would probably do the trick.
    I'm pretty sure there is a way to override both these functions - that's the basis of object orientated programming I think? I dunno how it's done though.
  • I found it. Framework.Functions.php GetUrl On line 451 comment out this line to // .($Suffix != '' ? $Suffix : '')
This discussion has been closed.