Fastest Redirection on Apache Server with Wordpress for a Small ~200 Page Website
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, redirects, wordpress, apache2, .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :If I have a website of about 200 pages and most of the links will be inevitably changing, what is the faster way to redirect them (fastest not in terms of how quickly I can do it, but in terms of the minimal load on the server)?
I have also made a differentiation between creating "RewriteRule"(s) that might redirect 20 links, versus using only the "Redirect" path commands.
Here are the different options that I see:
- Within a Wordpress plugin
- .htaccess RewriteRule when possible
- .htaccess Redirect always
- vhost .conf RewriteRule when possible
- vhost .conf Redirect always
I assume it is option 4, but I haven't found a very definitive answer online.
For 20 links, you are not going to notice a speed difference with any of those methods. None of them are going to add significant overhead.
There is significant overhead added by PHP and WordPress to run your site. The redirects are not going to impact performance at all.
For a very large quantity of redirects (thousands), individual rewrite rules are the worst option. Rewrite rules each have to be tested one at a time for each request. There is no way for the webserver to use a more efficient mechanism such as a lookup in a hash map.
Here is a question an ServerFault that addresses how to implement a very large number of redirects: Best way to handle thousands of permanent redirects It suggests using the RewriteMap functionality to do the lookup.
In the case of 20 redirects, scanning over them is going to be just as efficient as a hash lookup. Until you get to at least hundreds of redirects, it isn't something you need to worry about.
Comments
Post a Comment