Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > General Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
MULTIPLE cookieless domains (speed improvement)
LuisManson
Join Date: Jun 2010
Posts: 115

 

Show Printable Version Email this Page Subscription
LuisManson LuisManson is offline 07-09-2010, 10:00 PM

Since vbulletin uses a LOT of images plus CSS and JS i decided to separate all of them into cookie less domains

First of all on admincp set cookies only for your forum MAIN domain (ie www.mysite.com) not .mysite.com

DNS:
First of all i created some subdomains
static.mysite.com
static2.mysite.com
staticcss.mysite.com
staticjs.mysite.com

all of them pointing to the same server

Web server:
i created a new vhost:
Code:
<VirtualHost *:80>
    ServerAdmin webmaster@mysite.com"
    DocumentRoot "/usr/local/www/estaticos_mysite_com"
    ServerName static.mysite.com
    ServerAlias static2.mysite.com staticcss.mysite.com staticjs.mysite.com
    ErrorLog "/var/log/www/mysite-error.log"
    CustomLog "/var/log/www/mysite-access.log" combined

    Alias /images /usr/local/www/web_mysite_com/images
    Alias /clientscript /usr/local/www/web_mysite_com/clientscript
</VirtualHost>
Filesystem:
My vb site is in: /usr/local/www/web_mysite_com
and the static content is in: /usr/local/www/estaticos_mysite_com
inside this new vhost directory i also made two aliases (because of my permissions)

clientscript -> ../web_mysite_com/clientscript
images -> ../web_mysite_com/images

* given my permission direct access to this shite would give you a forbidden, maybe you could create an empty index file

htaccess:
i have a redirect for my domain so now i had to make a few changes to:
Code:
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteCond %{HTTP_HOST} !^static\.mysite\.com
RewriteCond %{HTTP_HOST} !^static2\.mysite\.com
RewriteCond %{HTTP_HOST} !^staticcss\.mysite\.com
RewriteCond %{HTTP_HOST} !^staticjs\.mysite\.com
RewriteRule (.*) http://www.mysite.com/$1 [L,R=301]
plugin:
go to your admincp and create a new plugin in global_complete hook
Code:
$oz_process = str_replace('"http://www.mysite.com/clientscript/vbulletin_css/', '"http://staticcss.mysite.com/clientscript/vbulletin_css/', $output);
$oz_process = str_replace('"clientscript/vbulletin_css/', '"http://staticcss.mysite.com/clientscript/vbulletin_css/', $oz_process); 

$oz_process = str_replace('"http://www.mysite.com/clientscript/', '"http://staticjs.mysite.com/clientscript/', $oz_process); 
$oz_process = str_replace('"clientscript/', '"http://staticjs.mysite.com/clientscript/', $oz_process); 

$output = $oz_process;
*original code from here: https://vborg.vbsupport.ru/showpost....1&postcount=13

images:
Go yo "templates and styles"
choose your style and then in Style Vars filter by imgdir
replace those PATHs with new-hostname/ + original path
IE: images/buttons -> http://static2.mysite.com/images/buttons


NOTE: because a bug in vb code here you can make a real mess, check this report first:
http://tracker.vbulletin.com/browse/VBIV-7479
* Long story short:
a solution that worked for me was from David Grove:
Quote:
The "fixes" described in the above comments are incorrect. To patch this issue, until v4.0.5 comes out, please edit line 489 of /admincp/stylevar.php, and change TYPE_ARRAY_ARRAY to TYPE_ARRAY.

So lines 485 through 491 should be changed from this:

PHP Code:
if ($_POST['do'] == 'savestylevar')
{
    
$vbulletin->input->clean_array_gpc('p', array(
        
'stylevar' => TYPE_ARRAY_ARRAY,
        
'original' => TYPE_ARRAY_ARRAY,
    )); 
To this:

PHP Code:
if ($_POST['do'] == 'savestylevar')
{
    
$vbulletin->input->clean_array_gpc('p', array(
        
'stylevar' => TYPE_ARRAY,
        
'original' => TYPE_ARRAY_ARRAY,
    )); 
This is of course, not the complete fix, but it will allow editing stylevars to work until v4.0.5 is released.
and you are done, now your site should be a bit faster
Reply With Quote
  #2  
Old 07-15-2010, 12:12 PM
lazydesis lazydesis is offline
 
Join Date: Sep 2006
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks .. very nice article

does this work for vb3.8? or is it only for vb4?
Reply With Quote
  #3  
Old 07-16-2010, 12:18 AM
klaus's Avatar
klaus klaus is offline
 
Join Date: Mar 2002
Location: Huntington Beach, CA
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If your htaccess goal is to simply force a www you can simplify it to:

RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule (.*) http://www.mysite.com/$1 [L,R=301]

It will now allow anyhost.mysite.com but when its just mysite.com without a subdomain or host it 301's to tripleW.

2lines vs. 6 lines
Reply With Quote
  #4  
Old 07-16-2010, 04:45 PM
Sayid Sayid is offline
 
Join Date: Jan 2009
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Useful article and it will improve page rank when I use firebug add-on in FF
Thanks and subscribed to this.
Reply With Quote
  #5  
Old 07-17-2010, 04:55 AM
tech4c tech4c is offline
 
Join Date: Jan 2009
Location: New Zealand
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Demo if you can !

Regards,
Reply With Quote
  #6  
Old 07-21-2010, 10:39 AM
LuisManson LuisManson is offline
 
Join Date: Jun 2010
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks all,
Sayid, how could this improve pagerank?
klaus: you are right, im not sure why i did it this way
lazyindian: it should work
Reply With Quote
  #7  
Old 07-23-2010, 12:47 AM
Shabcool Shabcool is offline
 
Join Date: Jul 2008
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
  #8  
Old 09-25-2010, 05:36 AM
as7apcool as7apcool is offline
 
Join Date: Feb 2009
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks 4 useful topic
Reply With Quote
  #9  
Old 06-15-2011, 04:43 PM
sivaganeshk sivaganeshk is offline
 
Join Date: Oct 2010
Posts: 250
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

should I paste this code ? where ? or is this commands?
Reply With Quote
  #10  
Old 06-18-2011, 05:41 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sivaganeshk View Post
should I paste this code ? where ? or is this commands?
Which code are you referring to? Basically the codes listed above need to be added to files, you edit, add the code then save and check to ensure the changes are present and you setup everything properly.
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 07:54 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.04462 seconds
  • Memory Usage 2,299KB
  • Queries Executed 23 (?)
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
  • (3)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete