Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a build script (Perl) that modifies the .htaccess file when I deploy my applications. As a double-check, I'd like to be able to perform some sort of syntax checking on the created .htaccess file.

I am familiar with the idea of using apachectl -t however, I am in a shared hosting environment and because of file access restrictions I cannot read certain configuration files specified by the sysadmins. Apachectl simply will not work in this regard.

Ideas or suggestions welcome.

share|improve this question
But even if you could run apachectl -t it is used for virtualhosts only it would not serve to your needs. My best guess would be that you gona need to make your own validator ... perhaps asking in the stackoverflow.com will get you a lead of how to go thru about this. At any rate this is more programming related from what i see. –  Prix Aug 28 '10 at 17:37

4 Answers 4

Here two useful, free services:

This one lets you upload an .htaccess file for validation.
This one lets you paste the contents of an .htaccess file into a textbox for validation.

share|improve this answer
Welcome to Server Fault! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Scott Pack Aug 26 '12 at 0:01
Also, a link and run like that does generally tend to get flagged as spam, so next time, it may be wise to consider adding some content and context into your post. –  HopelessN00b Aug 26 '12 at 3:09

There is no native .htaccess validator. If a third party tool exists, I am not sure if I would trust it. Since it is a script that modifies the file, you should be able to code the validation within your script.

You can also include testing and verification processes for your deployment, which would help reduce mistakes.

share|improve this answer
This would be part of the testing..... –  Danny Mar 23 '10 at 3:53

Using cool Text Editors like Coda for Mac or TextMate for Mac or maybe Notepad++ for PC, you can enable syntax highlighting, which might not be perfect, but will be helpful. .htaccess is written in Per, so just turn on Syntax Highlighting for Perl!

share|improve this answer

You can simply use Notepad++ for syntax checking.

Silas Brill has been gracious enough to create a custom language for htaccess files and share it here. http://notepad-plus.sourceforge.net/commun/userDefinedLang/Htaccess.xml

Just go to View -> User-Defined-Dialogue -> Import

and restart Notepad++. You should be able to see the new language under the Language option.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.