Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-01-2002, 08:50 PM
LanciaStratos's Avatar
LanciaStratos LanciaStratos is offline
 
Join Date: Oct 2001
Location: somewhere you're not
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I get the threadid?

I'm trying to change the URL's for forums and threads in an effort to make them more friendly to search engines like Google. I know there are several hacks with a rather different way of doing this, but I'm giving this method a shot. Right now I'm working on displaying threads by changing the normal URL (http://www.domain.com/forum/showthread.php?s=&threadid=123) to the new one (http://www.domain.com/forum/thread/123). I've almost got it working - here's what I've done so far:

- - - - - - - - - -

1. Created a copy of showthread.php and named the new file simply "thread" without any extension.

2. I then uploaded a .htaccess file in my forum directory containing the following (which will cause Apache to read the new "thread" file as a PHP script).
Code:
<Files thread> 
ForceType application/x-httpd-php 
</Files>
3. And, finally, in this new "thread" file, I've added these two lines (which I found from a post on the vB.com forums, they are highlighted in orange) at the very beginning of the file.
Code:
<?php

error_reporting(7);

$url_array=explode("/",$PATH_INFO); 
$threadid=$url_array;
$action = $HTTP_GET_VARS['action'];
$goto = $HTTP_GET_VARS['goto'];

if ( isset($goto) and ($goto=='lastpost' or $goto=='newpost')) {
  $noheader=1;
}
- - - - - - - - - -

After I perform the modifications above, I am able view a thread by using the new URL (http://www.domain.com/forum/thread/123). However, it will *only* show me the first thread on the forum (with a threadid of 1). I know the problem lies in the $threadid=$url_array; line, but I don't know what to change it to to fix it so that it will display whatever threadid number I specify in the URL. How should I change that line to achieve the desired effect?
Reply With Quote
  #2  
Old 12-01-2002, 08:58 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you had a look at fastforward's hack? It's quite effective. Also, go to vbulletin.com and have a look at filburt1's non-hack solution. Both use .htaccess to remap the path.
Reply With Quote
  #3  
Old 12-01-2002, 10:15 PM
LanciaStratos's Avatar
LanciaStratos LanciaStratos is offline
 
Join Date: Oct 2001
Location: somewhere you're not
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was scared away from fastforward's hack, but I just now discovered filburt's. But, alas, his version is giving me trouble, too! Please take a look at my problem if you get a chance.
Reply With Quote
  #4  
Old 12-01-2002, 10:29 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to get your host to allow you to edit .htaccess files on your server - your host has protected that file.
Reply With Quote
  #5  
Old 12-01-2002, 11:04 PM
LanciaStratos's Avatar
LanciaStratos LanciaStratos is offline
 
Join Date: Oct 2001
Location: somewhere you're not
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, it is on my own dedicated server, so that shouldn't be a problem. Where can I edit those .htaccess permissions? But, come to think of it, I've never had this problem with .htaccess files before, so it might be something else.
Reply With Quote
  #6  
Old 12-02-2002, 02:29 AM
LanciaStratos's Avatar
LanciaStratos LanciaStratos is offline
 
Join Date: Oct 2001
Location: somewhere you're not
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, never mind, I figured out my problem!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:38 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05410 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete