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.

Mod-Rewrite help...

edited February 2007 in Vanilla 1.0 Help
Now I've been sitting infront of my comp for hours trying to figure out how to do these and I can't for the life of me figure it out. I want to change http://forumurl/discussion/#/name/#Item_1 to: http://forumurl/threads/#/name/#Item_1 Simply global replacing all instances of discussion with threads doesn't work. Also I want to change http://forumurl/CategoryID to: http://forumurl/CategoryName

Comments

  • You'll need to copy the line:
    $Configuration['REWRITE_comments.php'] = 'discussion/';
    into your conf/settings.php file, and change discussion to threads, then change any references in your .htaccess file (i assume you've done that). I think that should do the trick...

    Make sure if you do a find&replace on your htaccess file that you dont replace any of the discussions section...
  • edited February 2007
    Great it worked perfectly, is there anyway I can modify the category to be the name and not the ID?

    Also I have the following code in the htaccess file so I can replace /?View=ParticipatedThreads and etc with my own dir structure but it's not working.

    RewriteRule ^participated/$ index.php?View=ParticipatedThreads [QSA,L] RewriteRule ^favorite/$ index.php?View=Bookmarks [QSA,L] RewriteRule ^private/$ index.php?View=Private [QSA,L]

    Do I have to do the same thing I did with discussion -> thread?
  • Also, after enabling the FriendlyURLS extension user's cannot edit they're posts. When they click edit it takes them to http://forumURL/post/post#/, which has nothing they posted in the post box...

    Any ideas?
  • bump'd. did changing discussion to threads break this?
  • I shouldn't imagine so...the redirect url seems like pretty normal behaviour... hmm.
  • When I go to http://forumurl.com/post/post #/ takes me to Start a new Discussion page and from there the text area is blank. So right now there's no way to edit a post.
  • hmm. can you paste the contents of your .htaccess file here?
  • RewriteEngine On RewriteBase / #Options +FollowSymLinks -Multiviews #Discussions RewriteRule ^discussions$ index.php [QSA,L] RewriteRule ^discussions/$ index.php [QSA,L] RewriteRule ^discussions/([0-9]+)$ index.php?page=$1 [QSA,L] RewriteRule ^discussions/([0-9]+)/$ index.php?page=$1 [QSA,L] RewriteRule ^([0-9]+)$ index.php?CategoryID=$1 [QSA,L] RewriteRule ^([0-9]+)/$ index.php?CategoryID=$1 [QSA,L] RewriteRule ^([0-9]+)/([0-9]+)$ index.php?CategoryID=$1&page=$2 [QSA,L] RewriteRule ^([0-9]+)/([0-9]+)/$ index.php?CategoryID=$1&page=$2 [QSA,L] #Comments RewriteRule ^discussion/([0-9]+/){1,2}[^/]*/(extensions|themes|images|ajax|js)/(.*) $2/$3 [QSA,L] RewriteRule ^discussion/([0-9]+/){1,2}[^/]*/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php|termsofservice.php) $2 [QSA,L] RewriteRule ^discussion/([0-9]+)/([0-9]+)/(.+)$ comments.php?DiscussionID=$1&page=$2 [QSA,L] RewriteRule ^discussion/([0-9]+)/([0-9]+)/(.+)/$ comments.php?DiscussionID=$1&page=$2 [QSA,L] RewriteRule ^discussion/([0-9]+)/(.*)$ comments.php?DiscussionID=$1 [QSA,L] RewriteRule ^discussion/([0-9]+)/(.*)/$ comments.php?DiscussionID=$1 [QSA,L] RewriteRule ^discussion/([0-9]+)/([0-9]+)$ comments.php?DiscussionID=$1&page=$2 [QSA,L] RewriteRule ^discussion/([0-9]+)/([0-9]+)/$ comments.php?DiscussionID=$1&page=$2 [QSA,L] RewriteRule ^discussion/([0-9]+)$ comments.php?DiscussionID=$1 [QSA,L] RewriteRule ^discussion/([0-9]+)/$ comments.php?DiscussionID=$1 [QSA,L] #Categories RewriteRule ^categories/$ categories.php [QSA,L] #Account RewriteRule ^account/$ account.php [QSA,L] RewriteRule ^account/([0-9]+)$ account.php?u=$1 [QSA,L] RewriteRule ^account/([0-9]+)/$ account.php?u=$1 [QSA,L] #Search RewriteRule ^search/$ search.php [QSA,L] RewriteRule ^search/([0-9]+)$ search.php?page=$1 [QSA,L] RewriteRule ^search/([0-9]+)/$ search.php?page=$1 [QSA,L] RewriteRule ^search/saved/([0-9]+)$ search.php?SearchID=$1 [QSA,L] RewriteRule ^search/saved/([0-9]+)/$ search.php?SearchID=$1 [QSA,L] RewriteRule ^search/saved/([0-9]+)/([0-9]+)$ search.php?SearchID=$1&page=$2 [QSA,L] RewriteRule ^search/saved/([0-9]+)/([0-9]+)/$ search.php?SearchID=$1&page=$2 [QSA,L] #Post RewriteRule ^post/$ post.php [QSA,L] RewriteRule ^post/([0-9]+)$ post.php?CommentID=$1 [QSA,L] RewriteRule ^post/([0-9]+)/$ post.php?CommentID=$1 [QSA,L] RewriteRule ^post/category/([0-9]+)$ post.php?CategoryID=$1 [QSA,L] RewriteRule ^post/category/([0-9]+)/$ post.php?CategoryID=$1 [QSA,L] #Settings RewriteRule ^settings/$ settings.php [QSA,L] #People RewriteRule ^people/$ people.php [QSA,L] #extension RewriteRule ^extension/$ extension.php [QSA,L] #Poll extension RewriteRule ^extension/([0-9]+)/$ extension.php?DiscussionID=$1 [QSA,L] RewriteRule ^discussion/$ comments.php [QSA,L] # Prevent some little bad effects of Friendly Urls on relative links in some # extensions RewriteRule ^(discussions|categories|search|post|settings|people|extension|[0-9]+)/(extensions|themes|images|ajax|js)/(.*) $2/$3 [QSA,L] RewriteRule ^(discussions|categories|search|post|settings|people|extension|[0-9]+)/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php|termsofservice.php) $2 [QSA,L] RewriteRule ^(discussions|account|search|post|[0-9]+)/.+/(extensions|themes|images|ajax|js)/(.*) $2/$3 [QSA,L] RewriteRule ^(discussions|account|search|post|[0-9]+)/.+/(account.php|categories.php|comments.php|extension.php|index.php|people.php|post.php|search.php|settings.php|termsofservice.php) $2 [QSA,L]
  • So what happens if you browse to:
    http://forum/post/1/?
  • It takes me to: Start a New Discussion
  • what if you go to /post?CommentID=1 ?
  • edited February 2007
    /post?CommentID=1 takes me to the page to edit that comment. now how can i bind that to /post/1 so I can edit it from there?

    also while we're squashing mod-rewrite bugs how come when I go to http://forum/account/6/ it takes me to my profile rather than the person who's supposed to be there?
  • Now that is wierd...what version of apache are you running? I'm far from a mod_rewrite guru and I'm currently finding it hard to keep my eyes open, but what if you comment out (add a # at the start):
    RewriteRule ^post/$ post.php [QSA,L]
    and then try going to post/1/ again?
  • Apache/1.3.29

    commenting out RewriteRule ^post/$ post.php [QSA,L] still takes me to the Start a new Discussion page.
  • Hmm...so the correct rule must be acting, I think. I'm a bit stuck here. Any other ideas, guys?
  • Could it be RewriteBase /? It's not part of the original file I had to add it in because when I clicked on the links it would give me a 404.
  • What happens if you comment it out then?
  • viewing the main page (All Discussions) works but if I go to any other threads or pages I get 404 errors
  • Yeah that makes sense. Doesn't help though. Hmm...
This discussion has been closed.