vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How can I get the threadid? (https://vborg.vbsupport.ru/showthread.php?t=46278)

LanciaStratos 12-01-2002 08:50 PM

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?

Erwin 12-01-2002 08:58 PM

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.

LanciaStratos 12-01-2002 10:15 PM

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. :)

Erwin 12-01-2002 10:29 PM

You need to get your host to allow you to edit .htaccess files on your server - your host has protected that file.

LanciaStratos 12-01-2002 11:04 PM

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.

LanciaStratos 12-02-2002 02:29 AM

Ah, never mind, I figured out my problem! :)


All times are GMT. The time now is 10:37 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01024 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete