Networking & Content Delivery

Optimize SEO with Amazon CloudFront

Search Engine Optimization (SEO) is the practice of optimizing your website to rank higher on search engine results pages. Since organic search is a primary way for viewers to discover online content, a solid SEO strategy involves optimizing your web application and maintaining good performance. As more than 92% of the internet searches happen on the Google search engine, the ranking of a website on Google’s search results page can have a significant impact on the amount of traffic a website receives, as well as its visibility and credibility. Google Search’s ranking algorithms incorporate Core Web Vital metrics, which are performance indicators evaluating a webpage’s loading speed, interactivity, and visual stability.

In this post, learn how Amazon CloudFront can improve the performance of your applications, which improves your website ranking on search engines.

How CloudFront can help improve Core Web Vitals

CloudFront is a content delivery network which overlays the public internet. The servers are strategically placed on the edge of the internet so that they are extremely close to the viewers accessing the content. CloudFront enhances the performance of content delivery by implementing optimizations at both the network and application layers. This enables it to offer broad coverage and faster access to the content. CloudFront has various use cases ranging from accelerating websites to providing software downloads in a secure manner, or the seamless delivery of streaming live/on-demand media.

CloudFront can improve Core Web Vitals by reducing loading times, improving server response times, and delivering a better user experience through caching and serving content from the nearest server to the visitor.

HTTP request flow with Amazon CloudFront

Figure 1: HTTP request flow with Amazon CloudFront

Create SEO-friendly URLs

An SEO-friendly URL is easy to read, contains relevant keywords, and accurately reflects the page’s content. This helps improve search engine rankings and user engagement. While creating SEO-friendly URLs, use descriptive and relevant words. It’s recommended to keep the URLs short, have canonical URLs to avoid duplicate content, use hyphens to separate the words, and avoid dynamic parameters such as session IDs in the URLs.

With Lambda@Edge, you can rewrite requested URLs at the edge and serve different content based on various conditional rules, all while maintaining the same URL that the viewer sees on their browser. This approach allows you to customize the content for different viewers or devices, without altering your origin server.

Create human readable, SEO-friendly URLs with Lambda@Edge

Figure 2: Create human readable, SEO-friendly URLs with Lambda@Edge

Personalize your content with segmented caching

Responsive and adaptive web designs are two popular approaches used to make websites mobile-friendly and make sure that they display correctly on devices with different screen sizes. Responsive web design uses the same HTML and CSS for all devices, with layout adjustments based on screen size. This allows the cache key to remain the same for all of the devices for a URL. However, adaptive web design requires different HTML and CSS for different devices, necessitating unique cache keys.

CloudFront cache policies are rules that define how content from an origin server should be cached and for how long. They can be customized based on factors like query string parameters and headers, and they can optimize website performance by reducing load times. Cache policies are applied to CloudFront distributions and can be managed via the CloudFront console, API, or AWS Command Line Interface (AWS CLI). Cache policies let you customize cache for different scenarios, such as forking cache for desktop vs mobile or splitting cache by country, even when serving the same URL to the viewer. This enables you to improve the cache offload and enhance the performance of your web application.

Domain consolidation

Domain consolidation is splitting resources across multiple domains to improve page load times in HTTP/1.1. However, it’s no longer recommended with HTTP/2 and HTTP/3. These protocols use multiplexing, so multiple requests and responses can be sent over a single connection simultaneously. Domain consolidation can actually have negative impacts on performance in these protocols by increasing the number of connections needed. As you consolidate the domains on the front-end, you can still keep the same directory structure on your web servers, and use Lambda@Edge to rewrite the requested URL and return the object to the user, without changing the URL on the user’s browser. This translates into faster loading times, which is especially important for mobile devices and slower internet connections.

Offload redirects to the edge

The SEO impact of HTTP redirects can be influenced by their performance. For example, if a redirect takes too long to load, then it can lead to a negative user experience and result in lower rankings. Multiple redirects in a chain, broken redirects, and redirect loops can also negatively impact user experience and search engine indexing. Therefore, it’s important to set up redirects correctly to avoid any negative impact on SEO. CloudFront Functions offer a solution by allowing you to offload your redirects to CloudFront edge locations, where JavaScript code is executed natively. This can improve website performance by reducing the number of round trips required. This can also scale instantly to handle millions of requests per second without bursting or throttling. By leveraging CloudFront Functions, you can optimize web performance and provide a better user experience for your visitors.

Offload your redirects at the edge, and save a round-trip to the origin every time the content is requested

Figure 3: Offload your redirects at the edge, and save a round-trip to the origin every time the content is requested

When deciding on the HTTP status code for the redirects, permanent redirects (HTTP 301) are generally preferred from an SEO perspective over temporary redirects (HTTP 302). Permanent redirects indicate that a page has permanently moved to a new location, and search engines will transfer most of the page’s ranking and authority to the new URL. In contrast, temporary redirects may not transfer the same amount of ranking and authority, which can impact the search ranking of the affected pages. It’s important to use redirects carefully and opt for permanent redirects whenever possible to maintain SEO value.

Handling site maintenance

When there’s an origin disruption event, it’s recommended to redirect viewers to a more user-friendly page, such as one hosted on Amazon Simple Storage Service (Amazon S3), to maintain a consistent and branded experience. CloudFront also negative caches the errors to protect the origin server from being overloaded. This is important from an SEO standpoint, as it helps prevent negative impacts on search engine rankings. To further enhance the viewer experience, it’s important to send an HTTP 503 error code along with a friendly error page to indicate that the downtime is temporary. This lets both viewers and search engines know that the disruption is being actively addressed and the site is expected to return to normal operation soon. By combining these practices, you can make sure that viewers have a positive experience even during periods of downtime, while also minimizing the impact on your SEO efforts.

It’s a good practice to return HTTP 503 in combination with a Retry-After header. This tells search engines like Google to wait a certain number of minutes before crawling the site again, helping to prevent the indexing of outdated information. This approach minimizes negative impacts on search engine visibility and helps maintain a positive user experience.

SEO impact when you change hosting infrastructure

When you switch your hosting infrastructure, such as migrating from one CDN to another, it’s normal to see a temporary decrease in Googlebot’s crawl rate due to changes in signals used to determine crawl rate. However, if there are no significant problems or slowdowns, Googlebot will try to crawl your site as fast as necessary and possible, potentially resulting in a higher crawl rate than before the move. This is because Googlebot must re-evaluate your website’s performance on the new platform, including its responsiveness and page speed.

Conclusion

CloudFront can play an important role in improving your website’s search engine optimization (SEO) efforts. By distributing website content to various servers around the world, CloudFront can improve website loading times, reduce bounce rates, and increase overall user engagement leading to better search engine rankings and more traffic to a website. Additionally, CloudFront can help websites handle sudden surges in traffic, preventing downtime, and make sure that the website remains accessible to viewers. Incorporating CloudFront into your website’s infrastructure can be a valuable strategy for improving SEO and enhancing the user experience.

Sagar Desarda

Sagar Desarda is the AMER leader of Edge Networking services specialist team, responsible for driving new business growth, technical engagements, and customer-facing publications. Sagar also manages ES business for AMER ISV customers and his team partners with the customers on their AWS architecture journey, oversees business-critical application operations with an aim to accelerate their digital transformation in the cloud.