Today, let's share N ways to optimize Hunk's website speed. Why N? Because there will be more and more ways to speed up the website, I will update here in time to help you solve the problem of slow website speed
The contents of this article are as follows
1. Purchase domain names on the right platform
What is the right platform? It is the platform in the same region as your website host, that is, the platform in the region where the target users of your website are located.
For example, if your website is in Chinese and you are facing domestic users, you can purchase domain names on domestic platforms, such as Alibaba Cloud.
In the same way, if you are a foreign trade website, you can buy domain names on foreign platforms, such as namesilo 。
Domain names in different places determine the DNS resolution time when customers open your website. The DNS resolution nearest to the user is faster and the time it is opened is shorter.
However, some friends have already bought domain names on domestic platforms to do foreign trade websites. In this case, there are two solutions. The first is to transfer domain names to foreign platforms. Reference The process of transferring the HiChina domain name to namesilo 。
The second one is relatively simple. Put the name servers on a foreign platform, such as cloudflare. In this way, DNS resolution is also fast. Please refer to How to use CDN to speed up your website – detailed use tutorial of Cloudflare free version 。
2. Use good space/server to speed up the website
This is the first element to ensure website speed.
The space for the website is like the engine for the car, which is also 1.5T. The new Civic can reach 7.2S at 100 meters acceleration, while other models of 1.5T can hardly reach such a fast speed
Generally, there are two types of space: shared space and VPS.
In the same case, VPS is generally faster than shared space.
If you are using Bluehost space and want to speed up, you can consider changing Siteground space Or linode, View the three-step purchase of a Linode host (including Linode discount code)
3. Use php7 to speed up the website
Php7 is much faster than php5 under the same conditions, and the smoothness of the website is much higher. So if your current space/vps is not based on PHP 7, you can upgrade PHP to 7, and the speed will be improved to a certain extent.
In addition, PHP has released 7.4, but the most stable version is 7.3. So if your space supports PHP 7.3, you can switch to 7.3. However, some topics already support 7.4. You can also use PHP 7.4 to see if it is compatible. If not, you can adjust it to PHP 7.3.
Here is a brief introduction to the method of switching php versions in bluehost space
1) First, make sure to back up the website, refer to The method of duplicator to backup the website
2) Enter the background of bluehost, click Advanced in the menu on the left, then click Multi PHP Manager, select the domain name you need to modify PhP in the open page, then select the PHP version you want to modify in the upper right corner, and then click Apply.
3) After the modification is completed, check the website immediately. If there is no problem, the speed should be improved to a certain extent.
If you use
Siteground space This can be ignored, because the site ground space uses the PHP 7.3 version by default, which is very convenient. If you want to switch to other PHP versions, you can refer to
How to switch the php version in the siteground space
If VPS is used, you can install the PHP 7 version when configuring the space. If you have already configured it, you can also upgrade from a lower version to PHP 7.
4. Delete useless plug-ins to speed up the website
The WP plug-in greatly extends the functions of the wordpress website, but everything has two sides. While the plug-in brings convenience, it also has several problems:
1) Slow down the website
2) The website may have problems due to conflicts with other plug-ins
3) There may be loopholes, which may result in being hacked
So you must be careful when installing plug-ins. Follow the principle of not pretending if you can( Don't try to install plug-ins because they don't cost money )
Take the AVADA theme website as an example. My website has no more than 10 plug-ins. Generally
- Fusion core (AVADA, mandatory)
- Fusion builder (AVADA5.0 theme comes with, must be installed)
- Contact form 7 Useful contact form plug-in
- Contact form DB inquiry record plug-in, offline, available on this site Free resources Download in the page
- Layerslider slider plug-in (you can also choose other easy to use plug-ins, and only one can be used for a website). Please refer to Layerslider creates banner video
- WP optimize optimizes the website, cleans the database and cache plug-ins, which can be installed when cleaning, and uninstalled when not in use
- Search meter search query plug-in, which can record all the words searched on your website and the number of search results, can help you enrich the website content
- W3 total cache plug-in
- duplicator Backup plug-ins can only be installed when backing up, and can be deleted when not in use
- SEO by yoast The SEO plug-in has powerful functions. It has the robot editing function and the XML website map function, eliminating a plug-in
Of course, it does not mean that there must be only 10 plug-ins, but as few as possible. Generally speaking, 10 plug-ins are enough for B2B enterprise websites.
So when you have a list of more than ten or twenty plug-ins, quickly check and delete unnecessary plug-ins.
Personally, I think the following common plug-ins can be uninstalled
- Google Analytics can directly put the GA code in the background of the theme without installing some plug-ins
- WP EDIT personally thinks that the editor function provided by WP is enough, and the webpage does not need to be colorful, so although this plug-in is powerful, it is a bit redundant
- The wp smush is a good plug-in, but it is unnecessary to install it. You can only upload the pictures after processing them locally. There is no need to increase the burden of the website in order to steal the lazy
- The plug-in installed by one button in the jetpack bluehost space is useless
- The plug-in installed by one click in the mojo bluehost space is useless
- Other useless plug-ins
In short, the principle is not to pretend if you can.
When you delete some unnecessary plug-ins, you will find that the speed has improved a lot.
Another problem is that many friends like to install more than one plug-in with the same function, such as 3-4 cache plug-ins. In fact, it is not very useful, because its functions are limited, and multiple plug-ins with the same function may also cause problems on the website, so only one plug-in with the same function needs to be installed.
5. The website correctly places pictures to speed up the website
Images can range from a few kilos, dozens of kilos to hundreds of kilos. If there are too many images, it will slow down the website.
Image optimization involves two steps
1) Use the correct size picture
For example, if you want to use 1/3+image frame on the home page of AVADA to place three pictures in parallel, the width of each picture is 337PX. If you place 500PX for each picture, you waste size because it can only display 337PX
For another example, if the sidebar is added to the product page made with portfolio, the content of the main body is only about 750px wide. If you put 1000PX pictures, it is also a waste
So you must upload pictures according to the actual size, rather than "overqualified"
2) Compress Picture
After determining the correct size, drag them to tinypng.com to compress them before uploading. Generally, the size can be reduced by 30% - 70%, so image compression is very important to improve the speed of the website.
However, only one compression is needed. The second compression is not so good and meaningless. Compression will inevitably reduce the quality. One compression is to find a balance between the size and quality of the image.
Special Reminder : Hunk always handles the size and compression before uploading images, rather than compressing images through plug-ins after uploading, because the plug-ins themselves will slow down the website, which is really unnecessary.
See the following figure for compression effect
6. Website plus HTTPS encrypted links to speed up the website
Https is a trend, whether from the perspective of SEO or security. In fact, on the other hand, https also improves the speed to a certain extent. Because https uses parallel downloading, which is equivalent to widening the road, there will naturally be more cars passing in a unit time.
If you use the bluehost space, you need to contact the online customer service to install the ssl certificate for you
If you use Siteground space , you can add SSL certificates in the background, which is very convenient, refer to Siteground install ssl certificate
7. Cache the website to speed up the website
1. Install the cache plug-in, such as wp bucket. Refer to Detailed setting method of wp bucket plug-in
2. The theme has its own cache function. For example, since 5.10, avada has added the functions of caching and merging requests, which has greatly improved the speed. Set in theme options – advanced – Dynamic CSS&JS, as shown below
Before AVADA, Hunk himself had experienced many themes, such as the 7, Goodspace, flato, etc., and felt that the speed was average, especially the 7, which was quite stuck (I experienced it recently, but still stuck).
A fast topic can achieve the most functions with the smallest code, AVADA Theme It is a representative. Of course, AVADA is not the fastest, but its comprehensive performance is quite excellent. Otherwise, it will not become the top selling wp theme on themeforest.
In addition, friends who have a certain foundation and are interested in code can try to write topics and simplify code themselves. Such topics are the fastest. For example, Hunk's blog theme is adapted from the official 2015 theme, which is quite fluent.
9. Exclude 404 resource links to speed up the website
What is the resource link of 404?
Generally, it refers to missing pictures or documents. For example, an image may be deleted accidentally, but the link on the web page is still there, so you call, open the web page, and download the resource constantly. The website has been working, and the burden is heavy. If there are many 404 link resources, the speed of the website will be significantly slower.
How to find 404 and deal with 404 links?
You can use the https://www.webpagetest.org/ This website is tested. If there are 404 links, it will be marked red to remind you.
Then find the link and restore it to the normal link.
10. The website does not use remote resources
What is remote resources? For example, if your website is A, but the pictures on it are from website B, it will also slow down.
The best way is to upload all resources (pictures, pdf documents, etc.) to your own website and then call.
On the other hand, many foreign trade websites use domestic statistical tools, such as CNZZ, Baidu Statistics, 51LA, etc. This is not to say that these statistical tools are bad, but because the JS code and other resources of these statistical tools are all in China, customers will slow down when they open your website.
Therefore, try to avoid this situation. Foreign trade websites Install Google webmaster and Google Analytics Quite good.
11. Use CDN to accelerate websites
CDN can not only speed up the website, but also allow users from all over the country to visit your website more evenly. At the same time, it can also protect your website from external attacks and restrict access to certain areas. It is very powerful.
At present, the CDN service that is relatively easy to use abroad is cloudflare. Please refer to the specific usage method Cloudflare Detailed Setup Tutorial
TO be continued…