• Welcome to PHPVIBE Forums. Please log in.
avatar_Marius P.

Speed PHPVibe up! Using a subdomain/cdn + Gzip

Started by Marius P.,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marius P.Topic starter

Here is the simplest trick to serve your website's css files from a subdomain or cdn (for speed loading).


Open lib/functions.php and find the function tpl() , this function is called on all js and css path files located on your server.


You can easily do something like this:


function tpl() {
//return site_url().'tpl/'.THEME.'/';
return 'http://cdn.videoinedit.com/';
}



In this case I've created a subdomain called "cdn" which has the root in .../tpl/main
Now all the css and js requests go to this subdomain.


Always a good idea to minimize and gzip css files.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.Topic starter

For gzip compression, here is a tip:

Once I've created the subdomain "cdn" with the root in /tpm/main I've placed there this .htaccess file:


<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml


  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>



The result from https://varvy.com/tools/gzip/ is attached (and that's only for one file per test).
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.Topic starter

Read also https://blog.crazyegg.com/2013/12/11/speed-up-your-website/

I usually don't go into 'webmastering' tips, but I got tired of all the questions about website speeding.
If it's PHPVibe, or Wordpress, or Drupal  or plain HTML website, the ways to optimize it and make it faster are pretty much the same.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

yafe3

thank Mario, and we are sorry for the pressure we put on you excuse us we are sorry
one of the things that made me choose phpvibe,not the other video cms you know them no need to mention
is i took my time and read and check about every video cms one of them have a good video cms mybe that time his cms was better then phpvibe but the guy was rude as i read from the customers
phpvibe (not now :) )are the nicest teams they know how to deal with customers even we ask some stupid question but when you are here we get the thanks
this kind of threads give credit to phpvibe
  •  

Marius P.Topic starter

PHPVibe will be "nice" once it actually have somebody on support. With me doing this after I'm already tired from custom work, of course I have no time to be nice, also, I'm not a people person :)

I've blamed people for this also, but go to the nicest person you know when he is tired and pick a contradictional discussion...see what happens :)

I understand Andrew being rude, I honestly do, If I let you 1 day, just 1 day handling PHPVibe's mails as Cristina does you'll literally wanna be done with humankind :)
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Similar topics (7)