最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Load time cost of using a redirect plugin v direct .htaccess entry

programmeradmin1浏览0评论

Occasionally, when I inherit a WordPress project developed by someone else, there is a plugin installed to do redirects. On my own projects, I enter all redirects directly into the .htaccess file.

My question is whether there is a load time issue with the redirect plugins? At some point in the past, I checked the .htaccess file on one of these plugins and noted that the redirects were not in the file. So, I assumed they are stored in the database, resulting in further database calls.

I am also thinking that for redirects in the database to run, WordPress would have to load first. It would seem that loading WordPress before the redirects can run, would result in further load time issues.

Occasionally, when I inherit a WordPress project developed by someone else, there is a plugin installed to do redirects. On my own projects, I enter all redirects directly into the .htaccess file.

My question is whether there is a load time issue with the redirect plugins? At some point in the past, I checked the .htaccess file on one of these plugins and noted that the redirects were not in the file. So, I assumed they are stored in the database, resulting in further database calls.

I am also thinking that for redirects in the database to run, WordPress would have to load first. It would seem that loading WordPress before the redirects can run, would result in further load time issues.

Share Improve this question asked Sep 25, 2019 at 17:01 Nora McDougall-CollinsNora McDougall-Collins 3952 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Assuming the redirect is for a resource or page that does not exist then you are most probably better off using a redirect plugin, not .htaccess, in order to prioritise "normal site visitors" and not the redirected traffic.

With a redirect plugin, the redirect logic need only be processed for requests that would otherwise return a 404 (Not Found). ie. Late in the request. Yes, this is more work for the "redirect", but less work for normal site visitors since a "normal" request does not even process the redirect logic. The fact that a "redirect" request takes a little more time does not matter.

If the redirect logic is in .htaccess then yes, the redirect happens quicker, but normal site visitors are impacted, since the .htaccess code is processed on every single request. (Note, "every single request" includes all your static resources, etc.)

For a few simple redirects the difference is most probably negligible. However, if you had 1000s of redirects (a large site migration for example) then using a redirect plugin (that executes late) becomes the only realistic option.

发布评论

评论列表(0)

  1. 暂无评论