PDA

View Full Version : Miscellaneous Hacks - vBSEO-style friendly urls using vB_Friendly_Url mechanism


alex.sk
02-20-2013, 11:00 PM
This plugin enables the following url scheme:

vbulletin/forum-name/
vbulletin/forum-name/index10.html
vbulletin/forum-name/thread-title-145.html
vbulletin/forum-name/thread-title-145-7.html
vbulletin/members/admin.html

This is close to what vBSEO 3.5.2 generates in its default configuration.
he original goal of this plugin was to allow ditching vBSEO during vB3-vB4 upgrade without suffering a massive link rot.
At this moment, this plugin may be used as a starting point to implement some specific link scheme, but it's hardly useful by itself unless you have that particual vBSEO version; vBSEO 3.6.0 uses different link scheme not compatible with this one.

The plugin hooks to the built-in url generation/parsing mechanism of vB4, overriding vB_Friendly_Url_* classes, unlike vBSEO which does whole-page preg replacements even in vB4. It works within the normal vB data flow, so it's small, simple, and quite fast. It's also very likely to play well along with other plugins like Cerberus.

The links generated by this plugin do not always match those of vBSEO. There are slight differences in handling non-alphanumeric characters, and probably other issues too. However, it should accept all vBSEO thread links, in the worst case (CANON_STRICT) issuing some 301 redirects.
Most of vBSEO configuration options are not supported. In particular, link structure is hard-coded. If you need something unusual, you may use this as a template, but you'll need to tweak it to get urls you want.
Blog urls are not implemented; the site I wrote this for does not use vB blogs.
Calendar urls and anything else not handled by vB_Friendly_Url is not supported.

Configuration resides on the standard Friendly Urls page.
The plugin can work in modes other than FRIENDLY_URL_REWRITE. It's not really indented to do it, it's more of a fallback option, but it's implemented. In FRIENDLY_URL_ADVANCED mode urls look like this:

vbulletin/forumdisplay.php/forum-name.html
vbulletin/forumdisplay.php/forum-name-10.html
vbulletin/showthread.php/thread-title-145.html
vbulletin/showthread.php/thread-title-145-7.html
vbulletin/member.php/admin.html

The plugin allows custom forum slugs, i.e. replacing forum-name with something else without changing the forum title. It's not pretty, but it works.

Sample .htaccess rules for FRIENDLY_URL_REWRITE:
RewriteBase /url/path/to/vbulletin

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Use these two only if you have friendlyurl_acceptvb4 enabled
RewriteRule ^threads/(.*) showthread.php [L]
RewriteRule ^forums/(.*) forumdisplay.php [L]

RewriteRule ^members/([^/]+).html$ member.php [L]
RewriteRule ^[^/]+/index\d*.html$ forumdisplay.php [L]
RewriteRule ^[^/]+/[^/]+.html$ showthread.php [L]
RewriteRule ^[^/]+/?$ forumdisplay.php [L]
Adjust ^members/ to match your friendlyurl_memberdir if necessary.

Tested on vB 4.0.3 PL8 and vB 4.2.0. Should work on most 4.x.x versions.
Feel free to post bug reports, suggestions etc. in this thread.

sodasusu
02-21-2013, 04:01 PM
i will try thx

final kaoss
02-21-2013, 04:37 PM
Ok so what about us who are already using the vbulletin friendly url htaccess rewrite (minus vbseo). Does it handle redirecting traffic to the proper urls as well?

Also are there any changes to be made to the htaccess to achieve the urls above?

vbulletin/forum-name/
vbulletin/forum-name/index10.html
vbulletin/forum-name/thread-title-145.html
vbulletin/forum-name/thread-title-145-7.html
vbulletin/members/admin.html

final kaoss
02-21-2013, 08:53 PM
Unfortunately there's something wrong with this plugin. This immediately appears when enabled. Disappears with plugin disabled. Also this only appears on forum.php

The other pages like threads, forums & member pages were rewritten though.

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4864 bytes) in /home/content/v/g/c/vgchat/html/forum/includes/init.php(336) : eval()'d code(466) : runtime-created function on line 1

dizzynation
02-21-2013, 10:11 PM
If you are going to install this, I highly recommend not doing so on a populate forum, perform it on a test site. Google is the main source for traffic for many forum owners, so please keep in mind that braking your urls will drop your SERPS like its hot.

final kaoss
02-21-2013, 10:20 PM
All the more reason to await this guy's response. :)

abdobasha2004
02-22-2013, 09:57 AM
what is the point of buying vbseo after vb4 ? !

alex.sk
02-22-2013, 11:34 AM
Ok, first of all:
DO NOT CHANGE URL STRUCTURE ON A LIVE BOARD
if you care about your Google rankings.
I didn't expect any questions in this direction, so I didn't even mention it in the first post.
Use a test board. Plan your moves and have redirects ready for your old urls if you decide to move.

Ok so what about us who are already using the vbulletin friendly url htaccess rewrite (minus vbseo)
Major link rot.
Same as installing vBSEO on a live board, atop of existing vB4 urls. It's a change in url structure.

Currently the board with this plugin activated will not recognize standard vB4 urls (forums/ID-name, thread/ID-name etc) and will not redirect them to resp. forum/thread-ID.html urls. I can be done, btw, I just didn't even think of it.

Also are there any changes to be made to the htaccess to achieve the urls above?
RewriteRules from the first post are necessary for FRIENDLY_URL_REWRITE mode to work.
Same as with standard vB4 urls.

final kaoss, which vB version do you use?
That looks really bad, but the only runtime-created function in the plugin is used in array_map(..., preg_split(...)), I wonder what could go wrong there.
In any case, I guess I'll try it one something more recent than my 4.0.3 in a day or two, some maybe there will be updates from my side.

what is the point of buying vbseo after vb4 ?!
None?
For me, it's about moving from vB3+vBSEO to vB4 while keeping the links intact.
An alternative to this plugin being vB4+vBSEO, which, I totally agree, makes little sense.

final kaoss
02-22-2013, 12:59 PM
I am using vb 420 PL2. Waiting for 421 and just skip PL3 altogether.

Black Snow
02-22-2013, 02:49 PM
I am using vb 420 PL2. Waiting for 421 and just skip PL3 altogether.

Is there going to be a 4.2.1?....

final kaoss
02-22-2013, 02:58 PM
It is planned yes.

dizzynation
02-22-2013, 07:40 PM
Major link rot.
Same as installing vBSEO on a live board, atop of existing vB4 urls. It's a change in url structure.



None?
For me, it's about moving from vB3+vBSEO to vB4 while keeping the links intact.
An alternative to this plugin being vB4+vBSEO, which, I totally agree, makes little sense.


VBSEO offers more then just SE friendly URL's - it has about 85 functions that can increase your rankings, URL rewrites is just one.

I think this is a great mod idea for 3.8.7 vbseo users to vb 4.2 without vbseo - If it works, I hope it does for users. Best of luck

alex.sk
02-23-2013, 01:34 PM
Version 0.6 uploaded. Standard vB4 style urls are now accepted, FRIENDLY_URL_BASIC mode fixed
Note you'll need two more RewriteRules for the old urls to work.

final kaoss: works well for me in vB 4.2.0.
Check what you've got on line 466 of your init_startup.

VBSEO offers more then just SE friendly URL's - it has about 85 functions that can increase your rankings, URL rewrites is just one.
Are they described or listed anywhere?
My impression from the code is that it's 50% url rewrites, 30% general housekeeping (admincp, db, caches etc), 10% for template tweaks (title, meta etc) and the remaining 10% for stuff I have no idea about.

final kaoss
03-10-2013, 04:03 AM
Are you talking about your plugin's init_startup or vbulletins init_statup.php file? Because afaik both of those are vanilla, aka untouched.

alex.sk
03-11-2013, 09:34 AM
I have a strong impression part of this thread is missing.

I meant init_startup hook from datastore. I.e. the piece of eval()'d code where line 466 happens to be.
Unless you have better ideas, something like

if($_GET['dumpinitstartup']) var_dump(vBulletinHook::fetch_hook('init_startup') );

right before line 336

($hook = vBulletinHook::fetch_hook('init_startup')) ? eval($hook) : false;

in includes/init.php, and then calling http://your/board/index.php?dumpinitstartup=1 should show you that code.

Because afaik both of those are vanilla, aka untouched.
That would be really strange. Line 466 in this plugin alone is nowhere near any user-defined functions.
In any case, with errors like this, I'd try to avoid any guesswork and make sure it's clear where exactly it happens.

alex.sk
03-11-2013, 09:49 AM
Also, a note: this plugin was written for vBSEO 3.5.2.
I didn't realize it but even 3.6.0 uses different link scheme in its default configuration.

final kaoss
03-11-2013, 04:12 PM
No idea, it decided to dump it all into one line doing it that way.

string(15810) "/** * * @param $ref - string - current search engine referrer * @return string - delemiter for current search engine referrer */ function seoqueries_get_delim($ref) { // Search engine match array // Used for fast delimiter lookup for single host search engines. // Non .com Google/MSN/Yahoo referrals are checked for after this array is checked $search_engines = array( 'google.fr' => 'q', 'google.com' => 'q', 'search.yahoo.com' => 'p', 'fr.search.yahoo.com' => 'p', 'search.msn.com' => 'q', 'bing.com' => 'q', 'search.live.com' => 'q', 'rechercher.aliceadsl.fr' => 'qs', 'vachercher.lycos.fr' => 'query', 'search.lycos.com' => 'query', 'alltheweb.com' => 'q', 'search.aol.com' => 'query', 'search.ke.voila.fr' => 'rdata', 'recherche.club-internet.fr' => 'q', 'ask.com' => 'q', 'hotbot.com' => 'query', 'overture.com' => 'Keywords', 'search.netscape.com' => 'query', 'search.looksmart.com' => 'qt', 'search.earthlink.net' => 'q', 'search.viewpoint.com' => 'k', 'mamma.com' => 'query' ); $delim = FALSE; // Check to see if we have a host match in our lookup array if (isset($search_engines[$ref])) { $delim = $search_engines[$ref]; } else { // Lets check for referrals for international TLDs and sites with strange formats if (strpos($ref, 'google.') !== FALSE && strpos($ref, 'reader') === FALSE) $delim = 'q'; elseif (strpos($ref, 'search.msn.') !== FALSE) $delim = 'q'; elseif (strpos($ref, '.search.yahoo.') !== FALSE) $delim = 'q'; elseif (strpos($ref, 'exalead.') !== FALSE) $delim = 'q'; elseif (strpos($ref, 'search.aol.') !== FALSE) $delim = 'query'; elseif (strpos($ref, '.ask.com') !== FALSE) $delim = 'q'; elseif (strpos($ref, 'recherche.aol.fr') !== FALSE) $delim = (strpos($_SERVER['HTTP_REFERER'], 'query')!==FALSE)?'query':'q'; } return $delim; } function seoqueries_get_position(){ if( preg_match('/cd=(\d+)/',$_SERVER['HTTP_REFERER'],$match) ){ return $match[1]; } return 0; } /** * * @param $d - delimiter in referrer string * @return string - search keywords */ function seoqueries_get_terms($d) { $terms = null; $query_array = array(); $query_terms = null; // Get raw query $query = str_replace( 'site%3A', '', $_SERVER['HTTP_REFERER'] ); $query = explode($d.'=', $query); $query = explode('&', $query[1]); $query = urldecode($query[0]); // Remove quotes, split into words, and format for HTML display $query = str_replace("'", '', $query); $query = str_replace('"', '', $query); $query_array = preg_split('/[\s,\+]+/',$query); $query_terms = implode(' ', $query_array); global $vbulletin; if( $vbulletin->options['seofq_enc'] != '' ){ $terms = htmlspecialchars( iconv("utf-8", $vbulletin->options['seofq_enc'], urldecode($query_terms)) ); }else{ $terms = htmlspecialchars(urldecode($query_terms)); } return $terms; } /** * This function looks for referrer variable and return it in special format (without "www." prefix) * @return string - referrer value */ function seoqueries_get_refer() { // Break out quickly so we don't waste CPU cycles on non referrals if (!isset($_SERVER['HTTP_REFERER']) || ($_SERVER['HTTP_REFERER'] == '')) return FALSE; $referer_info = parse_url($_SERVER['HTTP_REFERER']); $referer = $referer_info['host']; // Remove www. is it exists if (substr($referer, 0, 4) == 'www.') $referer = substr($referer, 4); return $referer; } /** * Return true if the referer is a search engine * @param $what - what info you are going to get * @return mixed */ function seoqueries_getinfo($what) { // Did we come from a search engine? $referer = seoqueries_get_refer(); if (!$referer) return FALSE; $delimiter = seoqueries_get_delim($referer); if ($delimiter) { $terms = seoqueries_get_terms($delimiter); if ($what == 'isref') { return ($terms != ''?true:false); } if ($what == 'referrer') { $parsed = parse_url($_SERVER['HTTP_REFERER']); echo ''.$parsed['host'].''; } if ($what == 'terms') { echo $terms; } } } /** * Gets type and id for current loading page * It may be homepage, single post page, static page, category page, tag page or archive page * @return array with two keys: 'type' and 'id' */ function seoqueries_get_type_id( $param ){ if (THIS_SCRIPT == 'forumdisplay' || THIS_SCRIPT == 'index' || THIS_SCRIPT == 'showthread'){ $return['type'] = THIS_SCRIPT; }else{ return array(); } switch(THIS_SCRIPT){ case 'forumdisplay': $return['id'] = $param['forumid']; //$return['id'] = $_GET['f']; break; case 'index': $return['id'] = 0; break; case 'showthread': $return['id'] = $param['threadid']; //$return['id'] = $_GET['t']; break; }; return $return; } /** * * @param $term * @param $min_founded - int, minimal number of 'founded' value for terms * @param $max_founded - int, max number of 'founded' value for terms * @return string - tag value (by default one from 'strong','h6'-'h2' You can edit tag list in setting in the wp-admin) */ function seoqueries_get_tag( $term, $min_founded, $max_founded, $tags_count ){ if( empty($tags_count) ) return false; $step = ($max_founded - $min_founded)/$tags_count; if ($step == 0){ return '0'; } $number = (int)($term['founded'] - $min_founded)/$step; if ($number == $tags_count){ $number--; } return $number; } function seoqueries_get_item_title($type,$id){ switch ($type){ case 'post': $post = get_post($id); return $post->post_title; case 'page': $page = get_page($id); return $page->post_title; case 'category': $cat = get_category($id); return $cat->name; case 'archive': return $id; case 'tag': $tag = get_tag($id); return $tag->name; } } function seoqueries_get_google_position($stid){ global $wpdb; $sql = "SELECT position FROM {$wpdb->searchterms_stats} WHERE position IS NOT NULL AND stid=$stid ORDER BY date_clicked DESC LIMIT 1"; return $wpdb->get_var($sql); } function seoqueries_last_clicked_date($stid,$page_type = false, $page_id = false){ global $wpdb; $sql = "SELECT date_clicked FROM {$wpdb->searchterms_stats} WHERE stid=$stid "; if (!empty($page_type) && !empty($page_id)){ $sql .=" AND page_type = '$page_type' AND page_id='$page_id' "; } $sql .=" ORDER BY date_clicked DESC LIMIT 1"; return $wpdb->get_var($sql); } function seoqueries_write_to_log($str){ $file = file_get_contents('plugin-log.txt'); $file .= "\n". time() ." : ". $str ."\n"; file_put_contents('plugin-log.txt', $file); } function seoqueries_init(){ global $seoqueries; global $vbulletin; if (!$seoqueries){ $seoqueries = new stdClass(); } $seoqueries->searchterms = TABLE_PREFIX .'seoqueries_terms'; $seoqueries->searchterms_data = TABLE_PREFIX .'seoqueries_data'; $seoqueries->searchterms_stats = TABLE_PREFIX .'seoqueries_terms_stats'; $seoqueries->searchterms_filter = TABLE_PREFIX .'seoqueries_filtered_terms'; //imitating http_referer variable uncomment this line if you want to test plugin /* $referers = array( 'http://google.com/?q=seoforums&cd=2','http://google.com/?q=superforum&cd=1','http://google.com/?q=vbulletin&cd=','http://google.com/?q=tendrassil','http://google.com/?q=rocket&cd=2','http://google.com/?q=moon','http://google.com/?q=beatles&cd=2','http://google.com/?q=commodi','http://google.com/?q=forum&cd=1','http://www.google.com/search?client=safari&rls=en&q=seoforums.org&ie=UTF-8&oe=UTF-8','http://google.com/?q=perspiciatis,','http://google.com/?q=omnis','http://google.com/?q=natus','http://google.com/?q=error','http://google.com/?q=voluptatem','http://google.com/?q=accusantium','http://google.com/?q=doloremque','http://google.com/?q=laudantium,','http://google.com/?q=totam','http://google.com/?q=aperiam','http://google.com/?q=eaque','http://google.com/?q=ipsa,','http://google.com/?q=inventore','http://google.com/?q=veritatis','http://google.com/?q=quasi','http://google.com/?q=architecto','http://google.com/?q=beatae','http://google.com/?q=vitae','http://google.com/?q=dicta','http://google.com/?q=sunt,','http://google.com/?q=explicabo.','http://google.com/?q=ipsam','http://google.com/?q=voluptatem,','http://google.com/?q=voluptas','http://google.com/?q=aspernatur','http://google.com/?q=fugit,','http://google.com/?q=consequuntur','http://google.com/?q=magni','http://google.com/?q=dolores','http://google.com/?q=ratione','http://google.com/?q=voluptatem','http://google.com/?q=sequi','http://google.com/?q=nesciunt,','http://google.com/?q=ne\que','http://google.com/?q=porro','http://google.com/?q=quisquam','http://google.com/?q=dolorem','http://google.com/?q=ipsum,','http://google.com/?q=dolor','http://google.com/?q=amet,','http://google.com/?q=consectetur,','http://google.com/?q=adipisci','http://google.com/?q=velit,','http://google.com/?q=numquam','http://google.com/?q=tempora','http://google.com/?q=incidunt,','http://google.com/?q=labore','http://google.com/?q=dolore','http://google.com/?q=magnam','http://google.com/?q=aliquam','http://google.com/?q=quaerat','http://google.com/?q=voluptatem.','http://google.com/?q=minima','http://google.com/?q=veniam,','http://google.com/?q=nostrum','http://google.com/?q=exercitationem','http://google.com/?q=ullam','http://google.com/?q=corporis','http://google.com/?q=suscipit','http://google.com/?q=laboriosam,','http://google.com/?q=aliquid','http://google.com/?q=commodi','http://google.com/?q=consequatur?','http://google.com/?q=autem','http://google.com/?q=reprehenderit,','http://google.com/?q=voluptate','http://google.com/?q=velit','http://google.com/?q=esse,','http://google.com/?q=nihil','http://google.com/?q=molestiae','http://google.com/?q=consequatur,','http://google.com/?q=illum,','http://google.com/?q=dolorem','http://google.com/?q=fugiat,','http://google.com/?q=voluptas','http://google.com/?q=nulla','http://google.com/?q=pariatur?', ); //$_SERVER['HTTP_REFERER'] = 'http://www.google.com/search?client=safari&rls=en&q=%D8%A7%D9%84%D8%A3%D8%BA%D8%A7%D9%86%D9%8A&ie=UTF-8&oe=UTF-8'; //shuffle($referers); //$_SERVER['HTTP_REFERER'] = array_pop($referers); $ref_count = count($referers); //$_SERVER['HTTP_REFERER'] = 'http://www.google.com/search?hl=ru&client=safari&rls=en&q=%40mail'; for($i=0;$i<100;$i++){ */ $abanded_chars=array('\'','\\','/','%','|','$','?',',','~'); $ref = seoqueries_get_refer(); $type_id = seoqueries_get_type_id($vbulletin->GPC); if (seoqueries_getinfo('isref')){ $referer = seoqueries_get_refer(); $delimiter = seoqueries_get_delim($referer); $terms = seoqueries_get_terms($delimiter); $terms_safe = str_replace($abanded_chars, '', $terms); if(strlen($terms_safe)<4){ return; } //use filter $sql = "SELECT * FROM ". $seoqueries->searchterms_filter; $result = $vbulletin->db->query_read_slave($sql); while( $row = $vbulletin->db->fetch_array($result) ){ //echo $row['filter'].' - '.$terms."\n"; if(stripos($terms,$row['filter'])!==false) return; } $sql = "SELECT * FROM ". $seoqueries->searchterms ." WHERE term_value='". $terms_safe ."'"; $result = $vbulletin->db->query_read_slave($sql); if (!empty($result)){ $term = $vbulletin->db->fetch_array($result); } $vbulletin->db->free_result($result); if (empty($term)){ $sql = "INSERT INTO ". $seoqueries->searchterms ." (term_value) VALUES('". $terms_safe ."')"; $vbulletin->db->query_write($sql); $sql = "SELECT * FROM ". $seoqueries->searchterms ." WHERE term_value='". $terms_safe ."'"; $result = $vbulletin->db->query_read_slave($sql); $term = $vbulletin->db->fetch_array($result); } if (empty($term)){ return; } //if banned if($term['ban']==1) return; global $seoqueries_type; if (empty($type_id)){ return ''; } $seoqueries_type = new stdClass(); $seoqueries_type->type = $type_id['type']; $seoqueries_type->id = $type_id['id']; $sql = " SELECT * FROM ". $seoqueries->searchterms_data ." WHERE stid=". $term['stid'] ." AND page_type='". $type_id['type'] ."' AND page_id=". $type_id['id']; $result = $vbulletin->db->query_read_slave($sql); $row = $vbulletin->db->fetch_array($result); if (empty($row)){ $sql = "INSERT INTO ". $seoqueries->searchterms_data ." VALUES ( ". $term['stid'] .", ". 1 .", '". $type_id['type'] ."', ". $type_id['id'] .", CURRENT_TIMESTAMP )"; $vbulletin->db->query_write($sql); }else{ $row['founded']++; $sql = "UPDATE ". $seoqueries->searchterms_data ." SET founded=". $row['founded'] .", last_click=CURRENT_TIMESTAMP WHERE stid=". $row['stid'] ." AND page_type='". $row['page_type']. "' AND page_id=". $row['page_id']; $vbulletin->db->query_write($sql); } //post to statistic $position = seoqueries_get_position(); $sql = " INSERT INTO ". $seoqueries->searchterms_stats ." VALUES ( NULL, ". $term['stid'] .", '". $type_id['type'] ."', ". $type_id['id'] .", ". $position .", CURRENT_TIMESTAMP ) "; $vbulletin->db->query_write($sql); } //}//for 100 fish of google } class SpambotHammer { static function markup() { global $vbulletin, $vbphrase; $r = array( sprintf('', TIMENOW), ); if ($vbulletin->options['spambot_hammer_safety_lock']) { $constants = array( 'SPAMBOT_HAMMER_MODULE_TIMER_MATURITY', $vbulletin->options['spambot_hammer_time_difference'], 'SPAMBOT_HAMMER_MODULE_TIMER_COUNTDOWN_TEXT', addslashes_js($vbphrase['spambot_hammer_module_timer_countdown_text']) ); $script = ''; if (version_compare(FILE_VERSION, '3.0.0', '>=') && version_compare(FILE_VERSION, '3.9.9', '<=')) { eval('$script = "' . fetch_template('spambot_hammer_module_timer_js') . '";'); } if (version_compare(FILE_VERSION, '4.0.0', '>=') && version_compare(FILE_VERSION, '4.9.9', '<=')) { $script = vB_Template::create('spambot_hammer_module_timer_j s')->render(); } $r[] = vsprintf('', $constants); $r[] = $script; } return implode("\n", $r); } static function upgrade() { global $vbulletin; if (isset($vbulletin->options['bot_blocker_time_difference'])) { require_once DIR . '/includes/adminfunctions_options.php'; require_once DIR . '/includes/adminfunctions_plugin.php'; save_settings(array( 'spambot_hammer_time_difference' => $vbulletin->options['bot_blocker_time_difference'], 'spambot_hammer_bounce_url' => $vbulletin->options['bot_blocker_bounce_url'], 'spambot_hammer_report_email' => $vbulletin->options['bot_blocker_report_email'], 'spambot_hammer_safety_lock' => $vbulletin->options['bot_blocker_safety_lock'] )); delete_product('bot_blocker'); } } } "

uninvited13th
04-14-2013, 01:16 PM
please fix

final kaoss
04-17-2013, 04:15 PM
Really though the only issue that I could find with it is that it enables the forum.php page to not render. The rest (forumdisplay, showthreads) works.

rmd708
05-06-2013, 07:08 AM
....found the problem....

final kaoss
05-19-2013, 12:46 AM
mind sharing?

Amaury
05-27-2013, 03:43 AM
Our owner installed this, and now we are getting this:
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home3/khmediaf/public_html/includes/init.php(336) : eval()'d code on line 183

Fatal error: Call to undefined method vB_Friendly_Url_Error::get_url() in /home3/khmediaf/public_html/includes/functions.php on line 7708We can access our Admin CP login panel via a direct URL, but we still cannot login because of the error in order to access Manage Products and disable it.

Any ideas?

ellenthompson
06-06-2013, 11:48 AM
Sir i got 404 error :( please help

final kaoss
08-14-2013, 09:41 PM
on which page did you receive 404?

dreamygirl
09-02-2013, 09:41 PM
Any help is appreciated. I am on 4.2.0 PL3. Upon installing, it gives an error. The error starts with Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in and IIRC it says line 46. I thought I found an extra ) in one of the hooks plugins. I hoped to find an extra ( and make the error stop. After removing the extra ), it has the same error, but with line 43.

final kaoss
09-03-2013, 12:57 PM
Might be a long shot but try this php checker.
http://phpcodechecker.com/

armagan
09-03-2013, 01:33 PM
...................

ozzy47
09-03-2013, 02:01 PM
To disable the plugin/hook system open your config.php which can be found in your forumroot/includes directory

Just below
<?phpenter
define('DISABLE_HOOKS', true);and save the file.

Then you can get into your ACP and disable the mod.

Then enable the plugin/hook system again, either remove the line again or simply comment that line out. To do so, add two forward slashes " / " so it will look like

// define('DISABLE_HOOKS', true);Next time you would like to disable the plugin/hook system again
you simply have to remove those two " / ".

ShortBuss
11-02-2013, 08:26 PM
Just installed this mod, so far so good. Adding a line for content.php helped as I'm running the suite.
RewriteRule ^content/(.*) content.php [L]
There's a few things I need to work out still. The lists/category hits a 404 but I should have that under control soon
Gone Fishing Forum (http://www.gonefishingforum.com/)

Thanks a ton for this mod! With vbseo on the outs I was wondering how I was going to get the tidy urls I wanted.

ShortBuss
11-02-2013, 08:40 PM
Sure nuff, adding a couple more lines to htaccess gets things rolling right along

RewriteRule ^blog/(.*) blog.php [L]
RewriteRule ^list/category/(.*) list.php [L]


Thanks again for the mod!

dreamygirl
11-02-2013, 11:57 PM
Sure nuff, adding a couple more lines to htaccess gets things rolling right along

You never got a parse error like the one I got above? Thanks.

schan
12-04-2013, 12:40 AM
Thank you for this awesome plugin. I noticed that after installing this plugin, it takes a lot longer to go back to the home page on my site. I understand that there is a very small performance hit, but it shouldn't take more than 5 seconds longer to load the homepage. In addition, the site does an ajax request and that request takes about 10 seconds to complete. Without the plugin, it completes almost instantly when page loads.

I simply installed your plugin, and modified the .htaccess file with your sample .htaccess code. The only thing different is that I took out the RewriteBase line. In addition, I added in three extra lines for security:

RewriteRule ^includes/(.*) index.php
RewriteRule ^vb/(.*) index.php
RewriteRule ^packages/(.*) index.php

Does this shed any clue as to why my site hit a decrease in performance? Thank you in advance.

schan
12-07-2013, 01:35 AM
The issue that I was having was that it took a long time to load up the home page. After troubleshooting, it was apparent that the algorithm to test for forum conflict names was causing a delay. I'm posting this as my solution just in case it helps anyone down the road.

If you have a huge forum, are experiencing slow page load, and have confirmed that you have no forum name conflicts, then remove this piece of code from the friendly url classes file.

else foreach($this->registry->forumcache as $fid => $finfo)
if(self::clean_fragment($finfo['title']) == $slug && $fid != $forumid) {
$clash = true;
break;
}

Only do this if you can ensure that there are no forum name conflicts.

dreamygirl
12-07-2013, 06:44 PM
I simply installed your plugin, and modified the .htaccess file with your sample .htaccess code. The only thing different is that I took out the RewriteBase line.

I wondered if you could shed light on my problem at all? It's unrelated but since you have familiarity with this mod and some coding knowledge. I posted about my problem at https://vborg.vbsupport.ru/showpost.php?p=2442673&postcount=25

Another user was having a problem like mine too. https://vborg.vbsupport.ru/showpost.php?p=2442673&postcount=22

schan
12-17-2013, 02:15 AM
Hey dreamygirl,

Sorry, I just came across your question for help in this thread.

I am actually running into the same issue right now on a different server. I'm looking into it and will post back with a resolution once I figure it out.

Hang in there!

-S

schan
12-17-2013, 02:41 AM
Dreamygirl,

For troubleshooting purposes, what version of PHP are you running?

Thanks,
-S

dreamygirl
12-17-2013, 04:07 AM
For troubleshooting purposes, what version of PHP are you running?


5.2.17 (There's a possibilty it was lower a few months ago.)

schan
12-17-2013, 10:57 PM
Dreamygirl,

I think I have the solution.

In the friendly Url Classes plugin, on line 26, the author uses an anonymous function (closure).

$stopwords = trim(implode('|', array_map(
function($x) { return preg_quote($x, "/"); },
preg_split('/(,\s*|\s+)/', $vbulletin->options['friendlyurl_stopwords'])
)));

Anonymous functions is a feature that was added in PHP 5.3, which means, servers running PHP 5.2.x would run into syntax issues - the exact issues that you and I are having.

I would advise you to test the plugin on a test server running PHP 5.3 to see if it solves your problem. If so, you may want to look into upgrading the current server from PHP 5.2.x to PHP 5.3 provided that it doesn't break anything else. If it does, then you will need to modify the code in the plugin to be 5.2 compatible.

This plugin works fine on our test server, which is running PHP 5.3.3. I'm almost certain this is the case, but I encourage that you test it for yourself before taking my word for it. I hope this helps.

-S

dreamygirl
12-18-2013, 01:06 AM
This plugin works fine on our test server, which is running PHP 5.3.3.

Thanks, I'll upgrade when I can. If I get an error on PHP 5.3 or up, my errors are probably from another installed mod.

zylstra
12-18-2013, 03:32 AM
Why not simply fix the code instead?

$pregquote_chars = array_fill(0,
count($vbulletin->options['friendlyurl_stopwords']), '/');
$stopwords = trim(implode('|', array_map("preg_quote",
preg_split('/(,\s*|\s+)/',
$vbulletin->options['friendlyurl_stopwords']),
$pregquote_chars)));

zylstra
12-24-2013, 02:13 AM
Also, be aware that some of the differences between this mod and vBSEO are:

In vBSEO attachments may appear to exist in the attachments/ folder, whereas Friendly URLs uses the stock reference.
In vBSEO forums may appear as /[forum-name], whereas Friendly URLs showed /[forum-name] as an error (in my experience. Please check your forums with no trailing slash).
Last post and first new post image links don't seem to work in Friendly URLs.
vBSEO keeps casing of title, whereas Friendly URLs lowercases the entire title for use in the URL.


Above
RewriteRule ^members/([^/]+).html$ member.php [L]
Add
RewriteRule ^[^/]+/clientscript/(.+)$ clientscript/$1 [L]

dreamygirl
12-24-2013, 06:54 PM
[LIST=1]
Last post and first new post image links don't seem to work in Friendly URLs.


Thanks for your list. I would like to see code to make /[forum-name] work without trailing slash, should be easy?

And to fix the last post and first new post links? That is a bug?

What does your included code do - keep the casing in Friendly URLs?

zylstra
12-25-2013, 01:32 AM
I would like to see code to make /[forum-name] work without trailing slash, should be easy?
# Add / to the end of virtual directories. This resulted in URLs like /home/[user]/public_html/[forum-name]/ , which isn't what you want.
RewriteRule ^([^/.]+[^/])$ $1/ [R]
You can try the above, but it didn't work for me. Perhaps try it with [L] at the end instead of [R].
And to fix the last post and first new post links? That is a bug?
I don't know about this one. I reverted to vBSEO so won't be troubleshooting this mod any further.
What does your included code do - keep the casing in Friendly URLs?
No it's not about the casing. Now that you mention it I can't remember what it is for. It had something to do with a css file that was called relatively (as opposed to absolutely, and so was being looked for in the /[forum-name]/ directories), but that I didn't have the time to figure out how to fix it in the skin/templates.

Wajow-community
12-27-2013, 02:26 PM
what i do wrong i get this:

The requested URL /diy-do-yourself/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Wajow-community
12-29-2013, 03:57 PM
nobody?

psychonikeo
01-06-2014, 06:42 PM
OK, i really hope you can help us out.

We were running VB3+vBSEO where all links were rewritten as follows:

www.baseurl.com/forum/subforum_name/ID-name_of_topic.html

Now we went live and we can't get the URL's to get in that format again in vb4. Will your plugin help with that?

josegmfid
01-07-2014, 05:22 PM
Hi,

How to remove ".html" ?

I like this:

vbulletin/forum-name/
vbulletin/forum-name/index10
vbulletin/forum-name/thread-title-145
vbulletin/forum-name/thread-title-145/7
vbulletin/members/admin

Wajow-community
01-13-2014, 02:46 AM
its work nice for me!

thx

Wajow-community
01-17-2014, 11:21 AM
I just have a problem .. When I turn on a topic then I automatically directed to the first page, even though I have responded so then I hear my reaction to be conducted if I click on the topic I have posted and not to the first article .. what now?

Ladillaxx
01-19-2014, 04:24 AM
I need help.
I need to change this
minecraft-noticias/%E2%BFqui%E3%A9n-fue-el-creador-de-minecraft-4.html

by this.

minecraft-noticias/?Qui?n-fue-el-creador-de-Minecraft?-4.html

Please someone tells me I should change?

Scalemotorcars
04-24-2014, 08:20 PM
My brain is melting trying to figure this out. Below is an old vbseo link. Will this mod be able to duplicate it.

http://www.anysite.com/forum/horse-drawn-vehicles/51378-civil-war-rucker-ambulance.html

shifaguy
05-05-2014, 07:19 PM
Is it possible to change
"vbulletin/showthread.php/thread-title-145.html"
to
"vbulletin/showthread.php/145-thread-title.html"
Just wanted to put that number before the title of thread, just like vbseo.

behcet
05-29-2014, 09:21 AM
how to remove forum-name ?
vbulletin/thread-title-145.html

repute
06-09-2014, 06:19 PM
Since I installed the mod everything is working fine but I cannot merge topics anymore I get the following message:

Please check that the URL includes a valid threadid, "t=xxx" or postid, "p=xxx" (where xxx is a number), and is not a redirect.

How can I fix this?

Thanks,

Matt

SlashOwnsU
07-11-2014, 06:57 PM
This plugin is a lifesaver ! Infinite thanks !

One problem persists though.
We have forum names with french accents, which generates forum page urls of the form
www.domain.com/forum/????/

I'm fine with that even though vbseo would remove these accents.
However, the plugin cannot find the forum assiciated with these urls (vbulletin error message).
Same if I manually type www.domain.com/forum/aeoi/

Any idea on how to fix this ?

caciocode
08-19-2014, 09:23 PM
Has anyone found a way to get rid of the .html at the end? Maybe have the post id come first.

Great plugin!

thetechgenius
08-22-2014, 12:55 AM
I would like to use this mod on a windows server 2008R2, but on windows servers the .htaccess is not used, Windows based servers use web.config, and its completely different code/rules. Do you have the htaccess converted code for web.config?

mehedimw
09-19-2018, 06:35 AM
i will try thx

after install this plugin my web not opening please help me
https://vborg.vbsupport.ru/showthread.php?t=295358