How to achieve 100% Page speed score without plugin

Discussion QuestionsCategory: ProgrammingHow to achieve 100% Page speed score without plugin
Tamunofiniarisa asked 2 months ago

Definetely I have over time researched and gone crazy, bought several caching and gziping, concantenating and minification of javascript, html, css, etc. But I just discovered one secrete that sped up my sites and gave me just two(2) http requests from over 300 request.

It was like a magic and please see details on my answer below!

Jobs from Indeed
1 Answers
Tamunofiniarisa answered 2 months ago

Trust me this will solution with surprise you.

Forget all the promises made by any plugin. The only cahing and compression plugin I have not tested is hummingbird. my solution is superb. Try it and you will thank me for it!

We have to do this together, though to speed up and optimize your wordpress or any other website right now.

Note This is more for advanced users who are comfortable with modifying the .htaccess file, php.ini file and wp-config.

This a secrete even Wh Host giants will not diclise so easily jy to sell… I am sharing with you for free. Please only one favour share this post and tell friends. Thank you.

First, you need to back up your website before making any drastic changes like this:

Step 1: Test your site on Google PageSpeed Insights, Pingdom Tools, and GTmetrix to view your current score.

Step 2: Open up your .htaccess file located in the root directory of your website. This can be found by accessing your files via FTP. What we want to do here is enable browser caching, protect from Ddos Attacks, cdn support, etc. Once you save the changes to your file, go back to your website and make sure it’s still functioning normally.

###################################################################################

RewriteEngine On

IndexIgnore *

Options +FollowSymLinks -Multiviews -Indexes

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript

<Files .htaccess>

order allow,deny

deny from all

Header Expiry

<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|webp|swf)(.gz)?(?.*)?$">

Header set Expires "Thu, 23 Aug 2222 00:00:00 GMT"

Header unset ETag

FileETag None

CORS-enabled images (@crossorigin)

———————————————————————-

Send CORS headers if browsers request them; enabled by default for images.

developer.mozilla.org/en/CORS_Enabled_Image

blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html

hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/

wiki.mozilla.org/Security/Reviews/crossoriginAttribute

# mod_headers, y u no match by Content-Type?!

SetEnvIf Origin “:” IS_CORS

Header set Access-Control-Allow-Origin “*” env=IS_CORS

———————————————————————-

Webfont access

———————————————————————-

Allow access from all domains for webfonts.

Alternatively you could only whitelist your

subdomains like "subdomain.example.com".

Header set Access-Control-Allow-Origin “*”

############################################################################################

RewriteCond %{QUERY_STRING} base64_encode.(.) [OR]

RewriteCond %{QUERY_STRING} (<|%3C).script.(>|%3E) [NC,OR]

RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]

RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})

RewriteRule ^(.*)$ index.php [F,L]

############################################################################################

Deflate files to fasten the loading

SetOutputFilter DEFLATE

AddOutputFilterByType DEFLATE application/x-httpd-php text/html text/xml text/plain text/css text/javascript application/javascript application/x-javascript image/jpeg image/jpg image/png image/gif font/ttf font/eot font/otf

# properly handle requests coming from behind proxies

Header append Vary User-Agent

# Properly handle old browsers that do not support compression

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4\.0[678] no-gzip

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Explicitly exclude binary files from compression just in case

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|pdf|swf|ico|zip|ttf|eot|svg)$ no-gzip

############################################################################################

START XML RPC BLOCKING

Order Deny,Allow

Deny from all

Allow from 192.0.64.0/18

Satisfy All

ErrorDocument 403 http://127.0.0.1/

FINISH XML RPC BLOCKING

RewriteOptions inherit

BEGIN Cache-Control Headers

Header set Cache-Control “max-age=2678400, public”

Header set Cache-Control “max-age=7200, public, must-revalidate”

Header set Cache-Control “max-age=2678400, private”

Header set Cache-Control “max-age=86400, public”

Header set Cache-Control “max-age=7200, private, must-revalidate”

END Cache-Control Headers

ENABLE COMPRESSION

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file .(html?|txt|css|js|php|pl)$

mod_gzip_item_include handler ^cgi-script$

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^application/x-javascript.*

mod_gzip_item_exclude mime ^image/.*

mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

BEGIN Expire headers

ExpiresActive On

ExpiresDefault “access plus 5 seconds”

ExpiresByType image/x-icon “access plus 2592000 seconds”

ExpiresByType image/jpeg “access plus 2592000 seconds”

ExpiresByType image/png “access plus 2592000 seconds”

ExpiresByType image/gif “access plus 2592000 seconds”

ExpiresByType application/x-shockwave-flash “access plus 2592000 seconds”

ExpiresByType text/css “access plus 604800 seconds”

ExpiresByType text/javascript “access plus 216000 seconds”

ExpiresByType application/javascript “access plus 216000 seconds”

ExpiresByType application/x-javascript “access plus 216000 seconds”

ExpiresByType text/html “access plus 600 seconds”

ExpiresByType application/xhtml+xml “access plus 600 seconds”

END Expire headers

# 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

##################################################################################

Remember, thw above will not give you 100% pagespeed without changes in your php,ini

DO NOT FORGET INITIALIZATION FILE, Different for joomla, Drupal, WordPress, etc. For WordPress, which I use, see below and add to the .htaccess file above, preferrably at the top or bottom fothe file stream:

BEGIN WordPress

RewriteEngine On

RewriteBase /shopfinish/

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /shopfinish/index.php [L]

END WordPress

Step 3: Limit the number of post revisions. By default, WordPress would store every single change you make in your pages, products, questions, and posts. This number of revisions or verions actually overpupulate the database and your website consequently becomes slow.

Locate your wp-config.php file in the root directory of the WordPress installation. Add this line of code to your file.

/*Limit Post Revisions**/

define( ‘WP_POST_REVISIONS’, 3);

End Post Revisions

Alternativly, you can set wordpress to not store revisions at all. You would then call your code out like this:

define( ‘WP_POST_REVISIONS’, false); but I do not like this just incase you mess up somewhere in you editing and you want to revert back.

Now the big part

Step 4: Locate your PHP.INI file. This varies depending on your host. Check your hosting control panel for a section labeled something similar to “CGI PHP Scripts”. Or just check with your specific host. You can use ftp to your root diectory and find the php.ini or creat one if missing.

When you located your php.ini file, you want to enable Gzipping. This will blow your mind.

Locate this:

Possible Values:

; On = Enabled and buffer is unlimited. (Use with caution)

; Off = Disabled

; Integer = Enables the buffer and sets its maximum size in bytes.

; Note: This directive is hardcoded to Off for the CLI SAPI

; Default Value: Off (Change this to "On") be careful as it could casue problems if you observee any anomalies, use the production value below (4096). which is 4kb

; Development Value: 4096

; Production Value: 4096

; http://php.net/output-buffering

output_buffering = Off

Now search for the following – the most imprtant part of this work

zlib.output_compression = Off ( Change this to "On")

zlib.output_compression_level = -1 *(Change this to level 6 instead of -1)*

The level “#” you currently have will more than likely be different. Set it to the number 6 as shown above. Save your file and make sure your website is still working correctly. You should be able to see an increase of speed of your website.

Step5: Retest your site on Google PageSpeed Insights to view your new score. How do they compare?

Check with GTmetrix, and Pingdom Tools

You can as well spend all the time you have to speed up your wedsite using CDN and CSS Sprites. They are recommended, Cloudflare, MaxCDN, KeyCDN, CDN77, Amazono Cloudfron (the one I use), etc,! However, until you can find that time and the expensive resource, just enabling the features I just showed you will speed up your WordPress website incredibly in less than 10 minutes of work! With no plugins at all!

Resources I used. Consider following these tutorials to better improve your website speed and optimization.

  1. Speed up your wordpress without plugin