Wp remove query strings from static resources

A trang web URL (Uniform Resource Locator) consists of several different components – a protocol (HTTP or HTTPS), a domain name name, and a path. All of these components work together to lớn retrieve a web page và display it on a browser.

Bạn đang xem: Wp remove query strings from static resources

Sometimes, a URL will include additional parameters, also known as query strings, khổng lồ filter & organize the content of a web page. For example, query strings help customers lớn find specific products on eCommerce websites.

However, query strings tend lớn create poorly structured URLs that might result in duplicated content, loss of crawl budget, and slower loading times. One effective way lớn prevent these issues is khổng lồ remove query strings from static resources in WordPress.

In this article, we will explain more about query strings, why you should remove them from static resources, và the methods of doing so. We will go over the manual method that involves adding code khổng lồ your theme files and an automatic method with the help of a plugin.


Plugin Stats:

Downloads: 40,000+Rating: 4.5/5Notable features: GZIP compression, cache-control headers, custom cache expiry timePricing: free

WP Performance Score Booster is a không lấy phí plugin that allows you to vì chưng browser caching, GZIP compression, & remove query strings. These features help you boost your site scores in platforms like GTMetrix, PageSpeed, and Pingdom.

The plugin comes with easy configuration – simply install, activate, and enable the features. However, before using this plugin, make sure GZIP compression is enabled in your website server. You will also need khổng lồ allow write permissions in your WordPress .htaccess file.

To remove query strings from static resources, go khổng lồ Settings -> WP Performance Score Booster. Then, click on the Remove query strings from static content and save your changes.


Testing the Final Result

Now that query strings are removed from every static resource on your website, it’s time to check your site’s performance. You can use any website performance tool, such as GTMetrix, Pingdom, or PageSpeed.

Xem thêm: Cài Đặt Theme Cho Wordpress 2022, 3 Cách Cài Đặt Theme Vào Wordpress

In this example, we are using GTMetrix to lớn display the thử nghiệm result before và after the optimization. Start by filling out your website address on the provided field, then click Test your site.

The following example shows the result after we removed query strings – the Impact button has turned green and is identified as Low.


Query strings are part of trang web URLs that contain characters like “?” and “&.” Dynamic resources use query strings to help web servers identify different asset versions from one another.

On the other hand, the static resources don’t benefit from query strings on the URLs. They prevent proxy caching servers khổng lồ cache your trang web properly. Therefore, we suggest that you remove them to avoid any issues in the future.

Here is a brief recap on how to remove query strings from static resources in WordPress:

Editing functions.php file – locate your functions.php tệp tin through the WordPress dashboard or a website hosting control panel. Insert the provided code lớn the functions.php file & save your changes.Installing plugins – install and activate tốc độ Booster Pack. On your WordPress dashboard, go to lớn Speed Booster -> Tweaks. Then, activate the Trim query strings option. We have also listed other caching plugins that you can use as alternatives.

We hope this article has helped you achieve better trang web speed thử nghiệm results after removing query strings from static resources.

Continue your WordPress learning journey

How khổng lồ Combine External JavaScript in WordPressHow khổng lồ Defer Parsing of JavaScript in WordPressHow lớn Reduce admin-ajax.php file Server LoadHow lớn Eliminate Render-Blocking JavaScript and CSS on WordPressHow to Speed Up a WordPress Site

Chuyên mục: Domain Hosting