Check and Test .htaccess File for Correctness

November 4, 2013

HTACCESS is a very important file. Bad syntax in this file can cause a lot of problems. Learn how to check and test syntax without uploading changes on live server.

If you’re a webmaster, you need no introduction of the .htaccess file. This is probably the most critical file on your web server and a misconfiguration in .htaccess can cause havoc on an otherwise smoothly running website. To avoid misconfiguration, you should be able to test and check htaccess file to see if correct syntax has been used in it.

.htaccess file is used for directry-level access control in a website’s structure. Whenever an HTTP request is made to the server, this file is checked for a number of things including whether access to the requested resource is allowed or not. This file is also used a lot for different types of redirection. This is the file that should be used to redirect www to non-www domain (or vice versa)

As you can see, .htaccess is an extremely important file –it is therefore vital that it’s syntax remains perfectly correct. But the question is how to test .htaccess syntax without uploading the changes on live website?

Thankfully there are a few tools available out there to help you in this regard.

Syntax and content of .htaccess file must be perfectly correct.

Use .htaccess Tester on Made With Love website

This utility on Made With Love website is really great. It not only tests the syntax of the code given by you but also it tells you the output of your code. Moreover, it gives information on how each and every line in your code worked. This helps you a great deal in debugging the code.

HTACCESS Tester

You need to enter htaccess code and a URL of your website for which the code is to be tested. You can enter other optional parameters as per your needs. The most useful feature of this utility is its debugger.

Use htaccesscheck.com

htaccesscheck website offers a simple tool to check syntax of code given by you. It tells you where your code is wrong and also tries to give suggestions as to how to remove these mistake.

It is highly recommended to use these utilities before uploading changed htaccess file on live server because a wrong syntax can cost you a lot of traffic and also trust rank on search engines.

Do let me know if you have a question related with this subject. Thank you for using TechWelkin.

Lalit Kumar is the Principal Author and Founder of TechWelkin. He is a web explorer and he enjoys finding useful information on the Internet. He loves to put things together to create a bigger solution. Lalit is passionate about technology, languages and literature. You can contact Lalit via email (techwelkin [at] gmail [dot] com) or Facebook (facebook.com/techwelkin).