• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Quickly and Greatly speed up your XenForo

DarkVodka

Formerly Wuebit
#21
have you checked your apache error log?
[Thu Apr 21 09:42:37 2011] [alert] [client 199.27.130.77] /home/***/public_html/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

I was missing a2enmod headers

Thanks fixed and working now :)
 

Ryan Kent

Well-known member
#22
Two questions.

You suggested Google as the jquery source. I selected Microsoft. It makes no difference to me so I am happy to choose any source. I just wish to understand if you believe Google is better then MS as a provider, or if it makes no difference.

For caching, I specifically asked about which settings would be best and Kier replied
XenForo is optimised for the default cache settings of the most common browsers. Nothing else makes sense.
http://xenforo.com/community/threads/page-optimization-leverage-browser-caching.15000/

I just desire the best overall settings and am seeking understanding.
 

Junior

Well-known member
#23
Thanks fixed and working now :)
Great! :)

You suggested Google as the jquery source. I selected Microsoft. It makes no difference to me so I am happy to choose any source. I just wish to understand if you believe Google is better then MS as a provider, or if it makes no difference.
Microsoft uses a CDN for their jquery the same as google so this is not going to be much of a change. Here is some people voicing their opinions if this is any help:
http://stackoverflow.com/questions/1447184/microsoft-cdn-for-jquery-or-google-cdn

On Average: Simply because it's used more (it's been around longer) ajax.googleapis.comis likely to be returned by DNS sooner than ajax.microsoft.com, simply because the local DNS server was more likely to get a request for it (this is a first user in the area penalty). This is a very minor thing and should only be considered if performance is extremely important, down to the millisecond.
For caching, I specifically asked about which settings would be best and Kier replied

http://xenforo.com/community/threads/page-optimization-leverage-browser-caching.15000/
As for the caching, there is many forms. Go ahead and add the .htaccess and fresh your page 2-3 times. You should notice a visible change in load time. I'm no expert but I'd say XenForo is not using the methods provided in the .htaccess and for good reason. The methods caches files that would greatly strain users such as images. If you replace an image, js, or css with the .htaccess you'd have to just about clear your cache for it to appear. This means you'd have to ask your members to clear it as well.

Why would you want to cache so strongly? Mostly because your site is developed to the stage you don't see it changing any time soon. Javascript files and css files have query tags at the end of them. When they are edited the query changes. This causes the browser to think its a different file, so it reloads it. You can use this trick on a holiday banner as well. Simply add ?_v1 to the end and it'll be uncached :)

Also look up your site here:
http://www.gtmetrix.com

You'll notice it says header expires and cache-controls are not set for specific files. These are the ones my .htaccess covers.

Every method supplied here will cause noticeable speed increased. Hope this helps. :D
 

Ryan Kent

Well-known member
#24
Thank you for the reply. The information you are sharing is extremely helpful. Not only are you helping me and others optimize our sites, but we are learning how the process works.

Last week I discovered Smush.it and already had that aspect covered. Based on your suggestion I installed XFOptimize today. After reading the article you shared on JQuery hosting I have decided to stick with Microsoft as my host. For the cookie free domain, I created my sub-domain and will do some testing tomorrow.

My last questions are about the cache control and headers.

Let's say I make a change to a CSS template. Are you saying the CSS file name will change based on the template change? Thereby forcing the browser to get the new file even though the old file is still cached?

Does it also work that way for images in threads?

It sounds like by using the cache this way, I would have to be careful with any other images I swap out. For example I swapped out a file called logo_twitter.png today. The new file is also named the same. If I use the cache as you suggest, I would need to change the name both in the file and any code that calls the file, correct?

Sorry for all the questions. I do see the value in what you are sharing. I just have to be certain otherwise I can foresee the nightmare of having some users not see the correct images/files from the site because they are using cache views.
 

Junior

Well-known member
#27
Let's say I make a change to a CSS template. Are you saying the CSS file name will change based on the template change? Thereby forcing the browser to get the new file even though the old file is still cached?

Does it also work that way for images in threads?

It sounds like by using the cache this way, I would have to be careful with any other images I swap out. For example I swapped out a file called logo_twitter.png today. The new file is also named the same. If I use the cache as you suggest, I would need to change the name both in the file and any code that calls the file, correct?

Sorry for all the questions. I do see the value in what you are sharing. I just have to be certain otherwise I can foresee the nightmare of having some users not see the correct images/files from the site because they are using cache views.
If it is a member that has seen the older image, they will see it until the cache header expires removes it. They can press ctrl+f5 and that often refreshes most image cache but other wise yes, they will see the old one if it is not renamed when replacing the image. You should old off on the extreme cacheing until you are quite satisfied with your site image wise.

As for the CSS the file name looks like /url/url/csshere.css_?v12930213123 The version number changes every time you edit the css. So yes, they will be loading a new css every time. The old css file is considered gone. It's better to have it cached so if you go weeks without editing it they aren't redownloading it every time they visit your site, it'll be cached instead, thus increasing speed.
 

Ryan Kent

Well-known member
#30
Cookie Free Domain
This is rather tedious way to speed up your site but a great way one.

1. Create a subdomain (if you don't know how to do this, contact your host provider). I generally name mine static. So it'll be http://static.YOURSITE.com
2. Move your skin folder and XenForo folder to the root of the subdomain folder.
3. In your admin control panel go to Appearance > Style Properties > General > Settings > Path to Image. Change it to http://static.YOURSITE.com
I took the above steps then decided to test. My PageSpeed score went down and I now have a new red flag for "minimize redirects".

I read this thread a couple times and I still am not clear. What I have done is create a new subdomain static.TeraPVP.com. I tried to follow ragtek's advice and, rather then copy my existing files, re-direct my sub-domain to my main domain. Am I doing something wrong with the re-direct?
 

Ryan Kent

Well-known member
#33
like this thread i only need help here because i can't locate this place in y xenforo copy
I just went through this same process.

In my root folder there is a "static" folder. I believe you are supposed to put a copy of your "js" folder into your static folder.

Personally, before I take that step I hope to have a reply on my last question. It seems wasteful to duplicate files on the same server. It takes up double the space both initially and in backups. Also, whenever you perform updates or make any change you need to update both locations.

I like Ragtek's idea of merely pointing the static sub-domain back to the main domain. The issue I am having is the optimizer is viewing these as redirects and giving a red flag saying I am not optimized because of the redirects.

XFRedirect.PNG
 

Ryan Kent

Well-known member
#34
hate to bump but does anyone know how to set a site up properly to use a sub-domain without duplicating files nor getting the re-direct flag in Page Speed?
 

Junior

Well-known member
#35
Hey oracle, the problem is the redirect. You need to manually edit the path of the images as stated in the first post. The only change from my first post is where you should point the subdomain. It should be pointed at your xenforo install instead of its own folder. Remove the redirect and edit each path.

Whats happening with the redirect errors is it loads the original image then sees it needs to load the "static" image. So it goes and loads that, causing both images to load.

Hope that clears a little up.
 

ChemicalKicks

Well-known member
#39
No. 5. Open forum list and change the paths.

Is this out of date, my default path reads like this " @imagePath/xenforo/widgets/forum-read.png " I've already changed my image path setting to the static source in General Properties, so it appears there's no need for this step now. :)