.htaccess or vhost: where to place your website redirection plan?

seo redirection 301

Once the migration plan is completed, the question of where to place it comes up. Several studies have been carried out to find the ideal location to place your SEO redirection plan. But where to place it ? Should it be placed in the .htaccess of the Apache file or in a PHP redirection module? Discover our answer here.

Apache or PHP ?

The results of the various performance tests that have been carried out over the last few years show that the level of performance is almost identical. To be more precise, regardless of the number of rules, whether the migration plan is placed in .htaccess or in the Apache VirtualHost, the result in terms of performance is practically the same. On the other hand, the use of a PHP module is to be definitively forbidden. Why not ? Because PHP language, although not lacking in performance, will not be able to manage a module requiring the execution of a large number of operations. It is the same for the modules to be set up, particularly present on WordPress. We also advise you not to use them. When choosing the location, if there is indeed one thing to remember, it is that the redirection plan must appeal to Internet users and indexing robots such as Googlebot, for example.

Location : our advice

The choice between .htaccess and VirtualHost can be made thanks to the ease of editing. Updating an .htaccess file is much more practical because it does not require the server to be restarted, unlike VirtualHost, which requires, at the very least, a reload of Apache.
To finish with this question of the ideal location of the redirection plan, we recommend that you manage your redirections yourself. You can do this either in .htaccess or in the Apache VirtualHost. Note that this operation can be done very easily with the new Swan tool.