| | |
vBulletin mod_rewrite for vB 3.0.7
Please support our Existing Scripts advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
This is unfortunately not possible. Remember, behind the scenes, the .html pages are really just aliases for their php counterparts. If we do a 301 redirect on the php pages to redirect to the html pages, and then tell Apache that the html pages are aliases for the php pages, we're going to end up in an infinite loop, and no real page will ever be loaded.
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
•
•
Join Date: Apr 2005
Posts: 4
Reputation:
Solved Threads: 0
Hi Dani. This is a very wicked tutorial, it looks like it took a lot of time and energy to create so thank you for sharing it with the rest of us lowely peons. 
I have a question for you though... I noticed that the archive already makes use of more search engine friendly urls and I currently have the spiders redirected there with the spiders file. I was wondering what your thoughts were about keeping the spiders to the archive versus letting them crawl a mod_rewritten friendly url? Thanks!
PS: I had a bonus question since your the guru! I was thinking of useing mod_rewrite or something similar to include the thread names in the archive's url. I understand there is a performance hit but I'm trying to gauge what the trade off might be. Thanks again.

I have a question for you though... I noticed that the archive already makes use of more search engine friendly urls and I currently have the spiders redirected there with the spiders file. I was wondering what your thoughts were about keeping the spiders to the archive versus letting them crawl a mod_rewritten friendly url? Thanks!
PS: I had a bonus question since your the guru! I was thinking of useing mod_rewrite or something similar to include the thread names in the archive's url. I understand there is a performance hit but I'm trying to gauge what the trade off might be. Thanks again.
I think a good way to work the archive is the way that I did at http://www.daniweb.com/techtalkforum...117122-12.html
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
•
•
Join Date: Apr 2005
Posts: 16
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by cscgal
This is unfortunately not possible. Remember, behind the scenes, the .html pages are really just aliases for their php counterparts. If we do a 301 redirect on the php pages to redirect to the html pages, and then tell Apache that the html pages are aliases for the php pages, we're going to end up in an infinite loop, and no real page will ever be loaded.
This link would be in the postbit template - ensure it looks like the one posted in this tutorial.
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
•
•
Join Date: May 2005
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by cscgal
Answers to your questions:
(2) To make your archive work like a sitemap, where the links to the threads redirect to your *real* forum threads (mod_rewritten versions, of course!) then make the following two changes to your archive/index.php file. (Just as in the above tutorial, replace the first line with the second line)
[html]
echo "<p class=\"largefont\">$vbphrase[view_full_version] : <a href=\"$vboptions[bburl]/forumdisplay.php?f=$foruminfo[forumid]\">$foruminfo[title]</a></p>\n<hr />\n";
echo "<p class=\"largefont\">$vbphrase[view_full_version] : <a href=\"../../forum$foruminfo[forumid].html\">$foruminfo[title]</a></p>\n<hr />\n";
echo "\t<li><a href=\"" . (!SLASH_METHOD ? 'index.php?' : '') . "t-$thread[threadid].html\">$thread[title]</a>" . iif($pda, " <i>(" . construct_phrase($vbphrase['x_replies'], $thread['replycount']) . ")</i>") . "</li>\n";
echo "\t<li><a href=\"../../thread$thread[threadid].html\">$thread[title]</a>" . iif($pda, " <i>(" . construct_phrase($vbphrase['x_replies'], $thread['replycount']) . ")</i>") . "</li>\n";
[/html]
I tried these 2 line modification to my archive file. The index page would not even load. Is there anything need to be added in the .htaccess file also?
•
•
Join Date: Apr 2005
Posts: 16
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by cscgal
This link would be in the postbit template - ensure it looks like the one posted in this tutorial.
!sorry but another problem : on online.php I get some
unknown place
/forum84-2-lastpost--25--1.html
unknown place
/post163310-3.html
unknown place
/thread13032-painter.html
for many lines it's ok.
By default, the hack only fixes the generic forum and thread URLs in Who's Online. It doesn't handle multiple pages or when search queries are used, etc. For a completely mod_rewritten Who's Online, make the following changes to the includes/functions_online.php file. In each instance, replace the commented out line (the line with the //) with the non-commented line that appears below it. The lines will appear in the same order within the file as noted below.
[php]
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#post$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// edited by dani
/* $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a><br />" .
"<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>"; */
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a><br />" .
"<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"announcement.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"announcement$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forumd$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"printthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"printthread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"printthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"printthread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>"; }
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
[/php]
And then, below[php] convert_short_varnames($values);
$userinfo['values'] = $values;[/php]add[php]
// added by dani for seo hack
if (eregi("forum([0-9]+)", $filename, $fmatch))
{
$filename = 'forumdisplay.php';
$values['forumid'] = $fmatch[1];
}
if (eregi("thread([0-9]+)", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("threadnav([0-9]+)-([0-9]+)", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("threadmode([0-9]+)-(.*).html$", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("post([0-9]+)", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
if (eregi("posted([0-9]+).html$", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
if (eregi("postmode([0-9]+)-(.*).html$", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
// added by dani for seo hack
[/php]
[php]
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#post$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// edited by dani
/* $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a><br />" .
"<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>"; */
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a><br />" .
"<a href=\"forum$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"announcement.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"announcement$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forumd$forumid.html\">$forumtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"printthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"printthread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"threadedpost$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"printthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"printthread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>"; }
// $userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
// $userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
$userinfo['where'] = "<a href=\"\">$vboptions[bbtitle]</a>";
[/php]
And then, below[php] convert_short_varnames($values);
$userinfo['values'] = $values;[/php]add[php]
// added by dani for seo hack
if (eregi("forum([0-9]+)", $filename, $fmatch))
{
$filename = 'forumdisplay.php';
$values['forumid'] = $fmatch[1];
}
if (eregi("thread([0-9]+)", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("threadnav([0-9]+)-([0-9]+)", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("threadmode([0-9]+)-(.*).html$", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("post([0-9]+)", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
if (eregi("posted([0-9]+).html$", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
if (eregi("postmode([0-9]+)-(.*).html$", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
// added by dani for seo hack
[/php]
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
![]() |
Similar Threads
- vBulletin mod_rewrite (PHP)
- [Revised] vBulletin Mod_rewrite Tutorial (PHP)
- vBulletin mod_rewrite for vB 3.0.7 (Social Media and Online Communities)
- vBulletin mod_rewrite in phpBB mod format (Existing Scripts)
Other Threads in the Existing Scripts Forum
- Previous Thread: Seeking Text Editor for web pages
- Next Thread: Error message: can I fix the problem?
| Thread Tools | Search this Thread |
Tag cloud for Existing Scripts






- would be for old indexed pages like showthread.php?t=23 ... to redirect to new urls with a 301 (moved permanently) header; is it possible ?
