How to compress my web site files

Description of your first forum.
Post Reply
marieamable
Posts: 9
Joined: Wed Jan 21, 2015 4:13 pm

How to compress my web site files

Post by marieamable » Wed May 20, 2015 9:18 am

How to compress my web site files for faster browser access .

camillefranoise
Posts: 8
Joined: Wed Jan 21, 2015 4:08 pm

Re: How to compress my web site files

Post by camillefranoise » Fri May 22, 2015 10:52 am

To enable compression.

For Apache

Edit your .htaccess file and add the following lines:

# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
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

After you’ve saved the .htaccess file, test your site again in GIDZipTest.
It should come up as compressed

florencelouise636
Posts: 9
Joined: Wed Jan 21, 2015 4:02 pm

Re: How to compress my web site files

Post by florencelouise636 » Tue May 26, 2015 11:00 am

Hello,
Compress your web site files through online zip compression software or website compressor software and manually you should do some point for faster your website like :

STYLE SHEETS

Just like HTML and JavaScript files, style sheets are actually just text documents. To make your CSS files smaller, one thing you can do is to learn CSS inside and out so you are able to use CSS more efficiently, for example using shorthand code and inheritance. This will reduce the amount of code needed to design your pages and result in smaller file sizes. 456 Berea Street has lots of good tips regarding optimizing CSS.
Some basic things you should always keep in mind:

• Avoid using CSS inside your HTML document as much as possible.
• Try to put your CSS in one separate file instead of several to reduce the number of files that need to be downloaded.
• To further reduce the size of your CSS you can “minify” it using a script that removes unnecessary characters. One example is Minify.

JAVASCRIPT

JavaScript should be handled in a similar way to CSS code. Try to avoid including JavaScript code inside the HTML document and instead have all code in one external file. By having your JavaScript in a separate file it will be cached in your browser and only downloaded the first time it is needed instead of every time.

• Avoid using JavaScript inside your HTML document as much as possible.
• Try to put all your JavaScript code in one file instead of several files.
• To further reduce the size of your JavaScript you can “minify” it using a script that removes unnecessary characters (just like with CSS files).

HTML

Since the HTML usually is usually quite compact it is normally more important to focus most of your on the other files. What you can do is to have in the back of your mind to try and avoid complex code, inline CSS and JavaScript and if you use comments, try to keep them short.
To further reduce the size of your HTML you can use a HTML compressor to make it smaller.

WEB SERVER COMPRESS AND COMBINE FILES

In addition to the tips above you can also configure your web server to compress files . Files that can benefit from this are HTML, CSS and JavaScript files (which just consist of text and are easy to compress).

briannacarter448
Posts: 8
Joined: Thu Jan 22, 2015 4:15 pm

Re: How to compress my web site files

Post by briannacarter448 » Thu Nov 11, 2021 5:24 am

Select the files you want to compress on your local computer. Right-click and select Send to > Compressed (zipped) folder on a Windows PC. Right-click and select Compress if you're using Mac OS. You can now use an FTP client or the cPanel File Manager to upload your zip file to your server.

ashleymiller967
Posts: 12
Joined: Thu Jan 22, 2015 3:40 pm

Re: How to compress my web site files

Post by ashleymiller967 » Thu Dec 16, 2021 5:00 am

1. Reduce the burden on JavaScript by deleting extraneous symbols and comments, resulting in a single-line JS file; 2. Obfuscate the JS code, resulting in a compressed source code.
3. reduce the CSS code size;
4. Remove any unwanted html code fragments.

Post Reply
cron