Does having a lot of 301 redirects noticably impact performance?
.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, 301-redirect, .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 :I just moved my website to Wordpress from another service. Unfortunately, this means that although I was able to import all of my previous content to Wordpress, the post permalinks are now entirely different.
Unfortunately, I can't simply change the structure of the permalinks in Wordpress because the old permalinks from the old website contain a random number in part of the permalink, so it's impossible to reliably reproduce the link.
My only option is to create 301 redirects to each article. That's no problem because I've also used a script to record and match the old permalink to the new permalink and they are all sitting in a text file.
My question is though, will having almost 1000 redirects in the .htaccess file significantly slow performance of the page overall?
will having almost 1000 redirects in the
.htaccessfile significantly slow performance
Having 1000 separate redirect directives in .htaccess could certainly impact performance, although that may not be "significant" to the running of your site.
However, you shouldn't be implementing these type of redirects (site migration, different URL structure with no discernable pattern) in .htaccess to begin with. The .htaccess file is processed on every single request, including all requests for your static resources (CSS, JS and images etc). You could make exceptions for your static resources, however, you don't need to...
You want to prioritise normal site visitors, not the redirects for URLs that have changed. Since the old URL does not exist then the code that processes the redirects should only execute when your site determines that it would otherwise result in a 404. Depending on your site structure, you could either do this with a custom 404 ErrorDocument or with a plugin in the case of WordPress. By doing it this way, normal site visitors that request a "new" URL are not impacted in any way.
What about a Wordpress plugin like Redirection.
Yes, I believe the "Redirection" plugin is able to do this. See also the question that @Stephen linked to in comments:
Comments
Post a Comment