If you are getting into technical SEO strategy, you may have come across mention of a .htaccess file. If you’re researching with WordPress, you may have also wondered why your redirects are not working after migrating to WP Engine.

About .htaccess and Technical SEO Strategy

.htaccess is a configuration file for web servers, such as the Apache web server. As the file is loaded into the root directory through the Apache server, the server then executes the directives listed in the file. With this, you’re allowed to add functionality such as redirection for Multisite and IP blocking.

A .htaccess file provides a way to create configuration changes on a per-directory basis. It is a part of Apache, and it’s not a part of PHP. These are usually used when you have no access to the main configuration files including the shared host. When it is placed in a directory that turns to ‘loaded via the Apache Web Server,’ then the .htaccess is executed and detected by the Apache Web Server software.

These .htaccess files include features such as altering the configuration of the Apache Web Server software to disable and enable additional functionality that the Apache Web Server software can offer. These facilities contain basic redirect functionality. For example, if you have encountered 404 file ‘not found’ error, image hotlink prevention, etc. Any request sent to the server will pass through .htaccess file.

How does .htaccess work?

There is a difference on how .htacess works on the WP Engine platform than other hosts. As stated, Apache server executes the .htaccess file. In some configuration, a page request will open up and Nginx checks to see if it is in Varnish. If so, then Nginx will fulfill the request, bypassing Apache altogether.

What is Varnish? It is an HTTP accelerator that is set in front of a server configuration to cache pages. It is known to be incredibly fast and using it along with Nginx will be as fast as WP Engine.

For more, you’ll need to think twice in using .htaccess file as not every request to your site will go through the Apache server.

Usage of .htaccess Files in the Server

Some of the usages of .htaccess files in the server include cache control to reduce server load and perceived lag, rewriting URLs, customized error responses, and authorization or authentication to specify any security restrictions with the filename “access.” The .htaccess will be accompanied by the .htpasswd file that stores all of valid usernames and passwords.

Was this article helpful to you?  Do you feel like you learned a bit about .htaccess files?  Let us know in the comments below!

Sources:

What is .htaccess and what does it do?

Avatar for Steve Scott

Steve Scott is the CEO & Director of Training at the New York SEO Training Academy. He has taught SEO skills to people from around the world and currently offers his hands-on search engine optimization training workshops in New York to individuals and businesses of all sizes. Corporate SEO training classes and consulting are also available.

Share This