Ultimate optimization and improved WordPress performance set

Source: Internet
Author: User
Tags gtmetrix image hosting wordpress database wordpress blog wordpress version

1. Upgrade Wordpress to the latest version.
2. delete unused plug-ins and upgrade the plug-ins in use
Many people like WordPress only because they like the power of WordPress plug-ins, but many of them are flashy. If there are a large number of plug-ins that have a certain impact on website speed and performance! At the same time, the WordPress plug-in author updates are quite fast. If you find a new version, we recommend that you change it to the latest version.
3. Optimize website Images
Although the speed of surfing the internet is constantly improving, it is also necessary to reduce the size of the image as much as possible. Of course, it is necessary to ensure the quality of the image. Modify the GIF and PNG formats!
4. image hosting
Try to save images in the article to other places, such as Google Picasa and Flickr. Instead of uploading data to your server. This can reduce the average CPU load/storage requirements of Web servers.
5. Select an excellent host
Of course, any optimization, if there is not a good host, then everything is empty talk! The host itself has quality problems, often goes down, and the speed is very slow. Even if you have the best SEO optimization technology, you should have no effect! Therefore, a good host plays an extremely important role in optimization! Now, the free host provided by webmaster encyclopedia is a very good foreign host. No record-filing is required, which greatly facilitates website creation by webmasters!
The benefits of site optimization are many. In terms of the following aspects:
1. page loading speed doubled
The improvements vary according to the site's original status and optimization level. Generally, it can be upgraded to 3 ~ 5 times.
2. Decrease site traffic
For the space with limited traffic, it is equivalent to reducing money.
3. Server Load Reduction
Traffic throttling, but also reduces the workload of the server, the CPU usage is limited, the number of concurrent space is not limited, it means to increase the maximum number of concurrent.
Since there are so many benefits, it is of course necessary to optimize the site. The following describes how to optimize the site:
1. Diagnostic Analysis
Before optimizing the site, use the site to describe online.
Currently there are many websites that can be analyzed online, but the most recommended is GTmetrix (http://gtmetrix.com ),
This website can perform all-round scanning and provide optimization suggestions and current ratings for the site. It also provides a comprehensive function for detecting and downloading the PDF format.
In addition to GTmetrix, Baidu also provides website speed diagnostics only when Baidu statistics (http: // tongji. Baidu. com) is installed.
It is recommended that you contact the two analysis items to analyze and copy the site, and have an understanding of the major situation of the site, and try to solve some problems that need to be solved.
2. Static Page
There will be no more details about what is static pages, and there will be a lot of comprehensive introductions.
The content of WP static is cos-html-cache. For details about the installation and usage, refer to: install several required plug-ins after WP.
3. Compress javascript and css
Compression here is not to use the compression algorithm to compress and encode the source file, but to break the space in the lost file, line feed, comment, and other useless characters. In other words, it is to compress the file.
Jsmin.exe newFile. js
OriginalFile. js must be in the same directory as jsmin.
Can also be provided with webmasters online compression thing: http://tool.chinaz.com/Tools/JsFormat.aspx
However, it is better to use jsmin to compress some large js files.
Css words with webmasters provide online css compression something can: http://tool.chinaz.com/Tools/CssFormat.aspx
4. Merge javascript and css
After WP has installed some themes or plug-ins, js and css will be applied more and more in the head.
When loading pages, every application is an http greeting. Therefore, reducing the number of js/css references will certainly speed up loading.
Therefore, you can merge multiple js/css files into a reference file, and then reference the lost js/css files to be merged.
This optimization operation is complicated and highly risky. It involves modifying code files, and some js/css may also use other resource files to cause the presentation of resource misappropriation after merging.
Therefore, we do not recommend that WP beginners perform this step unless they have control over the modifications.
5. Enable GZIP Compression
Here, compression refers to the use of compression algorithms to compress and encode files. All static resources, such as text, images, audios, and videos, can be compressed, but the compression ratio is not the same.
The webpage itself is a text, but the layout is html. js and css are also texts, but the layout is not the same.
Through the compression algorithm, you can greatly reduce the size of the text file, so that the speed of loading the text is doubled.
For websites, gzip compression is now widely used. It sends the page requested by the reader and the static resources referenced in the page to the client in the form of a compressed package,
Decompress and assemble the package on the client. Specifically, we don't need to worry about implementation. We just need to enable GZip.
First check whether the site has enabled gzip, you can use webmasters something to provide gzip check thing: http://tool.chinaz.com/Gzips/
If it has been enabled, it will not be enabled again; otherwise, you can intervene in two lines in the. htaccess file:
Php_flag zlib. output_compression On php_value zlib. output_compression_level 5
However, it is useless to add these two lines. It only enables the compression module. If the gzip detection site checks again, it still shows that it is not enabled.
Because no types of static resources have been specified for compression. Then, continue to step into. htaccess:
RewriteEngine On RewriteBase/RewriteCond % {REQUEST_FILENAME}-f RewriteRule ^ (. *) (js | css | html | htm) $/gzip. php? File = $1 $2 & type = $2 [L]
The above specifies that gzip and php files with different extensions such as js, css, html, AND htm should be replaced. Therefore, create a gzip. php file and put it in the same directory as. htaccess:
Another gzip check can be performed in Baidu's detection items. If everything is normal, you can no longer see that gzip has not enabled this item.
In the gzip detection of webmasters, gzip is enabled.
6. Set Client Cache
Once the static resources on the page are referenced, they will be saved in the client's folder.
If the service end sets the expiration time of static resources, before the expiration time, as long as the client waits for the page again, it will directly take the static files from the folder and not request to the service end.
Therefore, after setting the customer cache, as long as you have waited for a page, the speed of the page again within the expiration time will be greatly improved.
The configuration method is also relatively simple, as long as you intervene in a few lines in. htaccess:
# Expire images header ExpiresActive On ExpiresDefault A0 images image/gif A2592000 images/png A2592000 images/jpg A2592000 images/jpeg A2592000 images/ico A2592000 plain text/css A2592000 plain text /javascript A2592000
2592000 represents the meaning of a month, 2592000 = 60*60*24*30
7. Merge domain names
The so-called "merge domain name" means that if resources under other domain name sites are referenced, the resources are moved to their own sites and the resource reference address is modified.
In this way, the waiting request can only be performed under a small number of domain name sites, reducing the DNS addressing time.
For example, getting from a warehouse is faster than picking from a different warehouse.
From the perspective of optimization operations, it is to move the text and images from other sites to their own sites and reference them from their own sites.
8. Move the JS location
In a page request, javascript can load the following content only after loading, while css can be loaded in parallel.
Therefore, it is best to place references for downgrading js at the end of the page, that is, before.
Here the main site optimization operation is completed, I believe that after the completion of this series of optimization, the WP site's waiting speed has been greatly improved.
In addition, you can also use a very good optimization plug-in Autoptimize, which can automatically merge and compress all js/css on the page, and move the reference back. It is a high-performance optimization plug-in. If Autoptimize is used, steps 2, 4, and 8 can be skipped, which saves time and avoids the risk of modifying faults, and has a good effect.
However, Autoptimize compresses JavaScript/css based on the php pattern, and caches the. php generated by Autoptimize on the client.
In. htaccess, set the following conditions:
Header set Last-Modified "Oct, 31 Aug 2011 00:00:00 GMT"
The Last-Modified time can be specified at will, but it must be before the current time.
Of course, you can continue to do many things to speed up the site, such as using refined templates, reducing the number of homepage images and page js Code.
In other words, the website is optimized for the beautiful and indecent page layout, and the ultimate goal is to improve the user experience.
However, please believe in a truth that is always the same and accurate to all corners of the world-Simple is beauul ul!
WordPress tips-Speed Optimization-slow homepage opening
After installing WordPress, you can change all kinds of beautiful themes, but the speed is not satisfactory. Here are some common and practical methods to help you optimize the WordPress speed.
The solution may be slow to open the homepage due to slow running of the widgets_init () function. The solution is to edit the wp-include/http. php file.
In WordPress 2.9, the following code is available in lines 220:
Function request ($ url, $ args = array ()){
Global $ wp_version;
Add return in the middle; change
Function request ($ url, $ args = array ()){
Global $ wp_version;
After modification, the Google sitemap plug-in will not be able to generate sitemap. Change the sitemap plug-in so that it does not return when calling the request method,
You can try again if you have any questions.
Reduce the number of calls to php functions from templates on the home page in various topics, and change header. php footer. php or other php files to html as much as possible,
In this way, the database query is reduced, and the speed is naturally much faster. Those can be changed,
You can modify the name and keyword of a blog by yourself. The common functions are as follows:
: Blog name (Title)
: CSS file path
: PingBack Url
: Template File Path
: WordPress version
: Atom Url
: RSS 2.o Url
: Blog Url
: Blog webpage Html type
: Blog webpage code
: Blog description
: The title of a specific content Page (Post/Page)
For more functions, see the required wordpress-Tips for modifying common functions of a theme-theme function speed optimization.
Reduce the number of plug-ins. When the access speed of your blog slows down, ask yourself if the plug-ins have been installed in the past few days?
Plug-ins are one of the major killers that slow WordPress blog access. Go to the control panel and check how many plug-ins are enabled now.
We recommend that you use less WordPress plug-ins. Before using the plug-in, ask yourself: Is this plug-in required?
Wordpress can automatically abstract, affect the speed of the wp-utf8-excerpt is not necessary, see: wordpress tips-no plug-in home category automatic summary
Finally, you must note that the plug-in is not disabled but deleted.
If the plug-in provides a management interface, you can uninstall it first, and then delete the plug-in program, which is obvious for WordPress speed optimization.
Optimize the WordPress database, clear spam comments, and disable the log revision record function (that is, disable the article revision). You can use the plug-in to implement simple and secure one-click solutions.
For details, refer to: wordpress essential-database optimization plug-in WP-Optimize
Turning off the wordpress Article revision feature can be done by modifying the wp-config.php file at the end of the file?> Add above
/* Disable the page revision function */
Define ('wp _ POST_REVISIONS ', '0 ′);
The above code shields "Revision". There are several optional parameters and can be modified as needed (in the blue section, this section refers to 0 ):
True (default) or-1: Save all revisions
False or 0: Do not save any version (except the automatically saved version)
Integer n greater than 0: Save n revisions (+ 1 only save the automatically saved version), the old version will be deleted. (You only need to know about these items)
The advantage of optimizing images is obvious. First, you can save a lot of bandwidth resources, and the traffic is money. Second, image optimization can greatly speed up blog loading;
The image optimization is very simple. When you save an image, save it as a website application. The image format is as full as .jpg. The image size should be kept below 40 kb,
If you really don't want to use the image editing software to modify images, you can use the image compression function provided by Yahoo. If there are many images, you can use the image bulk Conversion Tool.
There are other Optimization Methods for WordPress which are not listed here. These are the most common and most useful methods. I hope they will help you.
For security, back up data or files before all operations!
16 simple and practical. htaccess skills
The. htaccess file is a very powerful configuration file of the Apache Web server. For this file, Apache has a bunch of parameters that allow you to configure almost anything you want .. The htaccess configuration file adheres to a Unix culture-using an ASCII plain text file to configure your website access policy.
This article includes 16 useful tips. In addition, because. htaccess is a very powerful configuration file. Therefore, a slight syntax error may cause your entire website to fail. Therefore, when you modify or replace the original file, make sure to back up the old files so that they can be easily restored in case of problems.
1. Use. htaccess to create a custom error page. This is an extremely simple task for Linux Apache. You can use the following. htaccess syntax to easily complete this function. (Put. htaccess in the root directory of your website)
ErrorDocument 401/error/401.php
ErrorDocument 403/error/403.php
ErrorDocument 404/error/404.php
ErrorDocument 500/error/500.php
2. Set the time zone of the website
SetEnv TZ America/Houston
3. Blocked IP list
Sometimes, you need to block some access by IP address. Whether it is an IP address or a network segment, this is a very simple task, as shown below:
Allow from all
Deny from
Deny from 124.15
Apache returns the 403 error for the rejected IP address.
4. transfer some old links to new links-Search Engine Optimization SEO
Redirect 301/d/file.html http://www.htaccesselite.com/r/file.html
5. Set email for the server administrator.
ServerSignature EMail
SetEnv SERVER_ADMIN default@domain.com
6. Use. htaccess to access and Stop leeching. If an image on your website is referenced by more than N other websites, this may cause your server performance to decline, use the following code to protect some popular links from being referenced too much.
Options + FollowSymlinks
# Protect Hotlinking
RewriteEngine On
RewriteCond % {HTTP_REFERER }! ^ $
RewriteCond % {HTTP_REFERER }! ^ Http: // (www .)? Domainname.com/[nc]
RewriteRule. *. (gif | jpg | png) $ http://domainname.com/img/hotlink_f_o.png [nc]
7. Block all requests from the User Agent
#. Htaccess Code: BEGIN
# Block Bad Bots by user-Agent
SetEnvIfNoCase user-Agent ^ FrontPage [NC, OR]
SetEnvIfNoCase user-Agent ^ Java. * [NC, OR]
SetEnvIfNoCase user-Agent ^ Microsoft. URL [NC, OR]
SetEnvIfNoCase user-Agent ^ MSFrontPage [NC, OR]
SetEnvIfNoCase user-Agent ^ Offline. Explorer [NC, OR]
SetEnvIfNoCase user-Agent ^ [Ww] eb [Bb] andit [NC, OR]
SetEnvIfNoCase user-Agent ^ Zeus [NC]
Order Allow, Deny
Allow from all
Deny from env = bad_bot
#. Htaccess Code: END
8. Redirect requests from some special IP addresses to other sites
ErrorDocument 403 http://www.youdomain.com
Order deny, allow
Deny from all
Allow from ip
Allow from ip
9. directly open the file instead of downloading it. Normally, when opening the online file, a dialog box is always displayed asking whether to download or directly open the file. This problem will not occur if you use the following settings, open directly.
AddType application/octet-stream. pdf
AddType application/octet-stream. zip
AddType application/octet-stream. mov
10. Modify the file type. In the following example, any file can be interpreted by the server as PHP. For example, myphp, cgi, and phtml.
ForceType application/x-httpd-php
SetHandler application/x-httpd-php
11. block access to. htaccess files
# Secure htaccess file
Order allow, deny
Deny from all
12. Protect files on the server from being accessed
# Prevent access of a certain file order allow, deny
Deny from all
13. Blocking directory browsing
# Disable directory browsing
Options All-Indexes
14. Set the default homepage
# Serve alternate default index page
DirectoryIndex about.html
15. Password Authentication-you can create a file for authentication. The following is an example:
# To protect a file
AuthType Basic
AuthName "Prompt"
AuthUserFile/home/path/. htpasswd
Require valid-user
# Password-protect a directory
AuthType basic
AuthName "This directory is protected"
AuthUserFile/home/path/. htpasswd
Require valid-user
16. convert old domain names to new ones
# Redirect from old domain to new domain
RewriteEngine On
RewriteRule ^ (. *) $ http://www.bkjia.com/$1 [R = 301, L]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.