943,706 Members | Top Members by Rank

Ad:
You are currently viewing page 6 of this multi-page discussion thread; Jump to the first page
Feb 22nd, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

testing hack on 3.5.4 forums, so far its working fine as mentioned above, shall do a little more testing and post the outcome.


Question 1:
Can you suggest some easier/quick way to add re-directions to a forum, re-directing all the incoming traffic from web to new locations after mod_rewrite

example:
re-directing a user from mydomain.com/forumdisplay.php?f=1 to mydomain.com/forum1.html
this should go for threads as well..

might help in restoring all the OLD PRs back again.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SaN-DeeP is offline Offline
18 posts
since Sep 2004
Feb 24th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

like SaN-DeeP said, it's working fine in vb 3.5.4, just need look for the following code at functions.php:
[PHP]function print_output($vartext, $sendheader = true)
{
global $pagestarttime, $querytime, $vbulletin;
global $vbphrase, $stylevar;[/PHP]
and make the changes!
ty dani
Reputation Points: 10
Solved Threads: 0
Newbie Poster
foxfirediego is offline Offline
1 posts
since Feb 2006
Mar 6th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Quote originally posted by alphacooler ...
I as well get 404's with links to /forums/forum2.html for all my forums in vb 3.5.2. Htaccess file has been uploaded and everything seems right.

Anyone on this?
I'm running 3.5.2 as well - and I'm getting 404s as well. .htaccess is working correct, and the links are generating correctly /forums/forum5.html etc. but its not working :cry:

I'm gonna go try another hack instead I guess.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
matrix_x is offline Offline
11 posts
since Jun 2005
Mar 10th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

[QUOTE=cscgal]Update: Hook Method instructions



I can confirm that it works via the Hook system (www.fencing.net/forums/) is an example of this mod working live using the Hook method.

Using vBulletin 3.5.4

Thanks Dani!

Craig
Last edited by fechten; Mar 10th, 2006 at 9:56 am. Reason: added vb version
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fechten is offline Offline
1 posts
since May 2005
Mar 12th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Ok can some one please help me i have been at trying to sort this for 2 days lol, I have done the following

Quote ...

STEP 1: Create an .htaccess file in your forum directory and put the following into it:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^getdaily.html$ search.php?do=getdaily [L]
RewriteRule ^getdaily([0-9]+).html$ search.php?do=getdaily&f=$1 [L]
RewriteRule ^unanswered.html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1	 [L]
RewriteRule ^unanswered([0-9]+).html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1 [L]
RewriteRule ^forum([0-9]+).html$		forumdisplay.php?f=$1		 [L]
RewriteRule ^forum([0-9]+)-([0-9]+)-([a-z]+)-(.*)-([0-9]+)-(.*).html$ forumdisplay.php?f=$1&page=$2&sort=$3&order=$4&pp=$5&daysprune=$6 [L]
RewriteRule ^forum([0-9]+)-(.*)-([a-z]+)-([a-z]+).html$	forumdisplay.php?f=$1&daysprune=$2&order=$3&sort=$4	 [L]
RewriteRule ^announcement([0-9]+).html$	 announcement.php?f=$1	 [L]
RewriteRule ^announcement([0-9]+)-([0-9]+).html$	announcement.php?f=$1&announcementid=$2 [L]
RewriteRule ^thread([0-9]+).html$	 showthread.php?t=$1	 [L]
RewriteRule ^thread([0-9]+)-([0-9]+).html$	showthread.php?t=$1&page=$2	 [L]
RewriteRule ^getnew.html$ search.php?do=getnew [L]
RewriteRule ^getnew([0-9]+).html$ search.php?do=getnew&f=$1 [L]
RewriteRule ^printthread([0-9]+).html$	printthread.php?t=$1	 [L]
RewriteRule ^sendthread([0-9]+).html$	sendmessage.php?do=sendtofriend&t=$1 [L]
RewriteRule ^referthread([0-9]+)-([0-9]+).html$ showthread.php?t=$1&referrerid=$2	[L]
RewriteRule ^lastpostinthread([0-9]+).html$ showthread.php?goto=lastpost&t=$1 [L]
RewriteRule ^newpostinthread([0-9]+).html$ showthread.php?goto=newpost&t=$1 [L]
RewriteRule ^nextnewesttothread([0-9]+).html$	showthread.php?t=$1&goto=nextnewest	[L]
RewriteRule ^nextoldesttothread([0-9]+).html$	showthread.php?t=$1&goto=nextoldest	[L]
RewriteRule ^post([0-9]+).html$	 showthread.php?p=$1	 [L]
RewriteRule ^post([0-9]+)-([0-9]+).html$	showpost.php?p=$1&postcount=$2	[L]
RewriteRule ^post([0-9]+)-([0-9]+)-([0-9]+).html$ showthread.php?p=$1&page=$2&pp=$3	[L]
RewriteRule ^thread([0-9]+)-([a-z]+).html$ showthread.php?mode=$2&t=$1	[L]
RewriteRule ^post([0-9]+)-([a-z]+).html$ showthread.php?p=$1&mode=$2	[L]

STEP 2:

In the includes/functions.php file, below
[php]
function print_output($vartext, $sendheader = 1)
{
global $pagestarttime, $query_count, $querytime, $DB_site, $bbuserinfo;
global $vbphrase, $vboptions, $stylevar, $_REQUEST;
[/php]

in 3.0.7 (in another version of 3.0.x, just put the code below the global declarations in the print_output function) add:

[php] // do Dani's SEO optimization
global $session;

$search_array = array(
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;order="). '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;daysprune="). '([^"]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"^&]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune="). '([^"^&]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]*)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=lastpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=newpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"printthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto=next"). '([a-z]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showpost.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;postcount=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]mode=") . '([a-z]+)' . preg_quote("&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;mode=") . '([a-z]+)\##',

'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;announcementid=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)"#',

// sanitizing
'#<a ([^>]*)href\=\"([^"]*)&amp;page=([^"]*).html"#',
'#<a ([^>]*)href\=\"([^"]*)&amp;highlight=([^"]*).html"#',

// other
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily&amp;f=") . '([0-9]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=&amp;childforums=1") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=") . '([0-9]+)' . preg_quote("&amp;childforums=1") . '"#'

);
$replace_array = array(
'<a \1href="forum\2-\3-\4-\5-\6-\7.html"',
'<a \1href="forum\2-\7-\5-\4-\6-\3.html"',
'<a \1href="forum\2-\3-\4-\5.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2.html"',
'<a \1href="lastpostinthread\2.html"',
'<a \1href="newpostinthread\2.html"',
'<a \1href="printthread\2.html"',
'<a \1href="sendthread\2.html"',
'<a \1href="next\3tothread\2.html"',
'<a \1href="post\2.html"',
'<a \1href="post\2-\3-\4.html"',
'<a \1href="post\2-\3.html"',
'<a \1href="thread\3-\2.html"',
'<a \1href="post\2-\3.html#',

'<a \1href="announcement\2-\3.html"',
'<a \1href="announcement\2.html"',

// sanitizing
'<a \1href="\2-\3.html"',
'<a \1href="\2-\3.html"',

// other
'<a \1href="getdaily\2.html"',
'<a \1href="getdaily.html"',
'<a \1href="unanswered.html"',
'<a \1href="unanswered\2.html"'

);
$vartext = preg_replace($search_array, $replace_array, $vartext);
[/php]
i have vBulletin Version 3.0.7 but i get this error msg

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /homepages/22/d122080877/htdocs/mkpitstop/forum/includes/functions.php on line 2094

please could some one tell me what i might have done wrong :-|
Reputation Points: 10
Solved Threads: 0
Newbie Poster
madkad is offline Offline
1 posts
since Mar 2006
Apr 8th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Greetings I won't even try to pretend I know even the slightest amount of this all though it is intriguing to say the least.
Just checking to see if I understand this prior to attempting and sorry for newbie question.
Currently running vb 3.5.3
Please correct me if I'm wrong in these steps.
(1)Create .htaccess file and add to root folder
(2)Locate

function print_output($vartext, $sendheader = true)
{
global $pagestarttime, $querytime, $vbulletin;
global $vbphrase, $stylevar;

then add below

//do Dani's SEO optimization
global $session;

$search_array = array(
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;order="). '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;daysprune="). '([^"]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"^&]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune="). '([^"^&]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]*)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=lastpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=newpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"printthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=") . '([0-9]+)"#', 
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto=next"). '([a-z]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showpost.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;postcount=") . '([0-9]+)"#', 
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]mode=") . '([a-z]+)' . preg_quote("&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;mode=") . '([a-z]+)\##', 

'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;announcementid=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)"#',

// sanitizing
'#<a ([^>]*)href\=\"([^"]*)&amp;page=([^"]*).html"#',
'#<a ([^>]*)href\=\"([^"]*)&amp;highlight=([^"]*).html"#',

// other
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily&amp;f=") . '([0-9]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=&amp;childforums=1") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=") . '([0-9]+)' . preg_quote("&amp;childforums=1") . '"#'

);
$replace_array = array(
'<a \1href="forum\2-\3-\4-\5-\6-\7.html"',
'<a \1href="forum\2-\3-\4-\5.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2.html"',
'<a \1href="lastpostinthread\2.html"',
'<a \1href="newpostinthread\2.html"',
'<a \1href="printthread\2.html"',
'<a \1href="sendthread\2.html"',
'<a \1href="next\3tothread\2.html"', 
'<a \1href="post\2.html"', 
'<a \1href="post\2-\3-\4.html"', 
'<a \1href="post\2-\3.html"', 
'<a \1href="thread\3-\2.html"', 
'<a \1href="post\2-\3.html#', 

'<a \1href="announcement\2-\3.html"',
'<a \1href="announcement\2.html"',

// sanitizing
'<a \1href="\2-\3.html"',
'<a \1href="\2-\3.html"',

// other
'<a \1href="getdaily\2.html"',
'<a \1href="getdaily.html"',
'<a \1href="unanswered.html"',
'<a \1href="unanswered\2.html"'

);
$vartext = preg_replace($search_array, $replace_array, $vartext);

Is this correct in my interpretation of this and is there any thing else I should be aware of for 3.5?
Thank you in advance
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blackknights is offline Offline
1 posts
since Apr 2006
Apr 12th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Excellent hack... Thanks Dani

Just a quick question... Should I get rid of the VB archive? I guess it will be useless and may be considered as duplicate content e.g. http://www.daniweb.com/techtalkforums/archive/

Secondly, how can I make the forum title (not thread title) to show in URL instead of "forumxxx.html" I can see you already have done this with this forum e.g. http://www.daniweb.com/techtalkforums/thread35147.html

Thanks once again for the great hack

Cheers,
Sync
Reputation Points: 10
Solved Threads: 0
Newbie Poster
syncmaster is offline Offline
1 posts
since Aug 2005
Apr 16th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Hi Dani,

I'm currently using 3.0.7 and your previous hack version. I mean "Mod re-write for 3.0.7"

Now, I'll upgrade to 3.5.4 and will use this "dirty" one

Yet, I tried this hack on my testing forum, and there are some differences from my current seo hack. My current hack's urls are like this, when navigating pages of a thread:

http://www.example.com/forum/threadnav1240-2-10.html

But this one is: http://www.example.com/forum/thread1240-2.html

As google indexed thousands of pages with threadnav1240-2-10.html style, I have a really big problem.

How can we fix it?

Thanks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
turker is offline Offline
11 posts
since Aug 2005
Apr 18th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Quote originally posted by turker ...
Hi Dani,

I'm currently using 3.0.7 and your previous hack version. I mean "Mod re-write for 3.0.7"

Now, I'll upgrade to 3.5.4 and will use this "dirty" one

Yet, I tried this hack on my testing forum, and there are some differences from my current seo hack. My current hack's urls are like this, when navigating pages of a thread:

http://www.example.com/forum/threadnav1240-2-10.html

But this one is: http://www.example.com/forum/thread1240-2.html

As google indexed thousands of pages with threadnav1240-2-10.html style, I have a really big problem.

How can we fix it?

Thanks.
Ok, I made it.

Adding this string to the .htaccess, I made my former urls accessible through Google though.

RewriteRule ^threadnav([0-9]+)-([0-9]+)-10.html$	showthread.php?t=$1&page=$2	 [L]
Reputation Points: 10
Solved Threads: 0
Newbie Poster
turker is offline Offline
11 posts
since Aug 2005
Apr 18th, 2006
0

Re: The quick 'n' dirty ultra simple vBulletin SEO hack

Hi Dani,

My ForumDisplay's numbered pages are unfortunately .php unlike yours. I mean, when I go to the 2nd page of any of my forums I see complicated php pages. How can I change this?

Thanks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
turker is offline Offline
11 posts
since Aug 2005
Message:
Previous Thread in Configuring Readymade Scripts Forum Timeline: Setting Up ColorBox(jQuery Modal window) In Blogger
Next Thread in Configuring Readymade Scripts Forum Timeline: how to create a custom category on opencart





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC