.htaccess redirect performance

前端 未结 3 425
野的像风
野的像风 2021-01-17 15:44

Are htaccess redirects any slower/put any more strain on Apache than redirects in configuration files? Also, how big can a number of redirects in htaccess get before they st

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 16:08

    Using a .htaccess file is slower than using a configuration file - a .htaccess file is parsed whenever a request is made to a directory it affects - this allows for changing the file without restarting the server. Since a configuration file is parsed only once at server start, it's faster.

    The amount of directives you can have in a .htaccess file without significant performance impact will be based on the complexity of the rules and your server's specifics, although the main performance hit will be from using the .htaccess file at all.

提交回复
热议问题