Redirects in .htaccess – WPO
Impact of Redirects on Web Page Speed

- Author:
-
Carlos Sánchez
- Topics:
- servers ,
- WPO
- Publication Date:
- 2024-08-30
- Last Review:
- 2026-01-23
A common myth is that redirects can slow down a webpage. It is true that redirects can add an additional overhead to the loading time of a page, but their impact is generally insignificant. However, depending on how they are implemented, this myth can be partially true.
I have often heard the argument that redirects should be avoided because they affect performance. This is said out of ignorance, and we will delve deeper into this topic here.
Properly implemented redirects, such as 301 redirects (permanent) or 302 redirects (temporary), are processed quickly. However, if they are misconfigured or chained, they can indeed have a negative impact on performance, consequently increasing loading times and generating additional requests to the server.
It is important to highlight that redirects are necessary in many situations, such as when a website's structure is changed. Therefore, a proper redirection strategy can prevent traffic loss and maintain SEO integrity without harming the user experience. In fact, they are more than necessary during migrations.
Ideally, all redirects should be made from the same place and in an orderly manner for future maintenance. This way, redirect chains can be avoided, and control over them can be maintained.
I firmly believe that this myth may have originated from the misuse of the .htaccess file, especially on Apache servers (which was the most commonly used server at the time the myth was created). The reality is, .htaccess is often used incorrectly.
How .htaccess Affects WPO
In SEO, there are numerous beliefs that can influence the design and optimisation decisions of a website. One of these is the idea that excessive use of redirects in the .htaccess file can slow down a website's performance. However, it is crucial to understand that the actual impact of redirects on web performance is more complex than commonly believed.
More than the issue of redirects, it is due to the use of this type of file.
You should avoid using
.htaccessfiles completely if you have access to the main httpd configuration file. Using.htaccessfiles slows down your Apache HTTP server. Any directive that you can include in an.htaccessfile is better set in aDirectorysection, with the same effect and better performance. — Apache Documentation
The Role of the .htaccess File
Before delving into the impact of redirects in .htaccess, it is important to understand the function of this file in the web development environment. This file is a powerful tool used on Apache web servers to configure various server options, such as redirects, access control, file compression, and more. It allows developers to modify server settings without needing direct access to the main server configuration.
We can understand it as an appendix used by both Apache and LiteSpeed. The advantage is that there is no need to access the main server configuration or restart the server. On the downside, this means the server needs to read these directives every time a user makes a request to the server. If these directives are lengthy and cumbersome, the server will take longer to process each request. If there are many users requesting from a server with an .htaccess file containing too many directives, it can cause loading issues.
In other words, .htaccess is read "at run-time," live, while other server configurations are preloaded, making it more efficient.
Performance Tests on .htaccess
Let’s examine various sources regarding the effect .htaccess has on performance.
SEOMike
SEOMike conducted testing on redirects, where there was a noticeable impact after 30,000 redirects.
However, this was using .htaccess with Apache, i.e., in the worst-case scenario. If the claims in the documentation and my own tests are correct, the low performance is due to the abuse of .htaccess, not the excessive number of redirects.

Netseven
NETSeven also conducted a comprehensive study on the subject.

The main conclusions of this analysis on the impact of using .htaccess files on an Apache web server are:
- Moderate impact on static sites: A small .htaccess file has a limited impact on the response speed of static sites, but its presence still affects performance. Allowing .htaccess files (AllowOverride All) reduces performance by approximately 16% compared to disabling them completely.
- Poor performance under large or complex file loads: Very large .htaccess files or those with complex directives can significantly reduce performance. For example, a 170 KB file full of directives can reduce server responsiveness by 90%, while a more realistic 12 KB file can reduce it by 40%.
- Centralised configuration is more efficient: Placing configurations directly in the main server configuration file instead of using multiple .htaccess files improves performance and security.
- Effects of directory hierarchy: The presence of .htaccess files at each level of a directory structure has a cumulative impact on performance, especially if the files are large or numerous.
- Comparison with other web servers: Although Apache shows a decrease in performance with the use of .htaccess, the performance difference does not necessarily justify using Nginx for static content exclusively, unless a very high volume of such content is being handled.
- Influence of storage: The type of storage (local SSD vs. NFS) did not show a significant difference in performance, likely due to Linux's read cache.
In summary, although the use of .htaccess files offers flexibility, it also comes with a performance penalty that should be considered, especially in high-traffic configurations or when using large and complex configuration files.
Strategiq
Strategiq also conducted their own analysis on the subject.

The analysis in the StrategiQ article on the impact of the number of rules in .htaccess files on server performance and scalability reveals several key points:
- Impact on Time to First Byte (TTFB): As the number of lines in an .htaccess file increases, the TTFB of files served in the same directory increases significantly. For example, an .htaccess file with 1,000,000 lines can result in a TTFB of up to 2.5 seconds.
- Impact on server scalability: Increasing the number of rules in .htaccess, especially during load testing, shows an increase in CPU and memory usage. This indicates that large .htaccess files can consume significant resources under heavy load conditions.
- Recommendations: To mitigate these effects, it is recommended to minimise the use of code in .htaccess whenever possible, consolidating directives in the server's central configuration file (httpd.conf). This reduces processing overhead and frequent disk access associated with .htaccess files.
This analysis highlights that the more rules contained in an .htaccess file, the greater the impact on server performance and scalability, which is crucial to consider in production environments where efficiency is critical.
Matthewedgar
In Matthew Edgar's article on redirects and their impact on website speed, it is concluded that redirects can significantly affect speed, especially through Time to First Byte (TTFB).
Redirect chains, where one page redirects to another successively, can add considerable loading time.
Additionally, redirects specified in an .htaccess file can increase server overhead if there are many of them, which also reduces site speed.
The article recommends minimising redirects and optimising redirect management to improve website performance. However, my conclusions remain that it is due to the abuse of .htaccess and the implications of the redirect chains themselves.

In any case, as we observed with SEOMike, there isn’t a significant change in performance until the redirect count reaches 30,000 lines.
Redirection Tests Without .htaccess
Even though there may be an impact, all the tests observed on servers not using .htaccess to generate redirects show minimal impact:
- Tom in nginx
- Joshmaker on Stackoverflow
- Do you want to conduct a serious study on how nginx or non-htaccess redirects affect performance? Contact me and I’ll get back to you.
You can analyse your own redirects with a redirect speed tester or you also have the option to analyse web performance (without needing a redirect or anything) by adding a lot of code to your htaccess file.
Conclusions
The reality is that it makes sense that the excessive code the server has to process every time it receives a request is what affects performance.
Redirects themselves have minimal impact on a website’s performance and speed. The key is to adopt good practices by understanding the nature of servers.
.htaccess should only be used for auxiliary code that needs to be implemented quickly. And although web speed can be optimised with commands in .htaccess, this is achieved simply because what those codes do improves speed more than the added weight of the file due to the increased number of lines.
Redirects do not slow down a website. But codes in .htaccess or a PHP file called throughout the site do. The problem is not the number of redirects but how they are implemented.
How to Implement Redirects Correctly
- Use regex when necessary. In fact, it is recommended; what is inefficient is to have 30,000 lines of code. Regex might be hard for us to process, but not for machines. Use it to save work and effort whenever possible.
- Always make all redirects from the same location. If you use different methods of redirecting, it will be easier to create a redirect chain. Additionally, always organise them by type of redirect, with comments on the reasons whenever possible.
- When creating a new redirect, check that the source of that redirect is not the destination of a previous redirect. If this occurs, simply replace the initial destination with the final destination.
- When the project starts to scale, move the redirects from .htaccess (if you’re using it) to httpd.conf. It’s true that the server needs to be refreshed to generate them, but you will improve performance. This does not mean .htaccess cannot be used, but that it should not be overused.
I currently offer advanced SEO training in Spanish. Would you like me to create an English version? Let me know!
Tell me you're interested