Adrian World Design
  • Services
    • Website Consulting
    • Startup Consulting
    • Zend Development
  • Portfolio
    • My Framework
  • Knowledge
    • Web Standards
    • PHP bare-bones
    • Zend Framework
    • Zend Framework 2
    • Git - Github
    • Search Engine Optimization
    • Web Hosting
    • Linux
    • Microsoft Windows
    • Web Browsers
    • Mobile Devices
  • About
    • Business
    • Professionally
    • Personally
  • Contact
    • Contact Form
    • Phone
    • Email
    • Messaging

Knowledge Base Overview

Verify .htaccess is read

Knowledge ⇒ Web Hosting ⇒ Apache Web Server ⇒ Verify .htaccess is read
Tweet
Share on Tumblr

Created: Feb 11, 2012, 9:24:10 AM CDTLast updated: Jul 12, 2012, 8:44:33 AM CDT

You set up a new website with your Apache (httpd) Web Server and add a default .htaccess configuration file to its web root folder with some site specific configuration directives. For some unknown and unexpected reason the rules fail, though. In other words the Apache htaccess configuration rules are not working.

First thing you should do in this case is check if your .htaccess file is even executed, i.e. accessed and load. There is obviously no need to look over the rules if it is not touched, right?

If you need more information about what the .htaccess is then see below What is .htaccess again?

Force an error

The simple solution to verify if the .htacess configuration file is even touched and parsed is forcing an 500 Internal Server Error.

Force an Internal Server Error

So, how do you force such a 500 Internal Server Error from a configuration file? Simple, add something to the first line of the .htaccess that doesn't make sense. Like just a single letter or number, a word, basically anything that is not a directive or complete directive in any form.

If you get the 500 Internal Server Error you will know that the file is accessed or touched and read; that first (garbage) line you added triggers the error.

If you don't get the error than your server setup is wrong, i.e. your .htaccess is either ignored or not found. Check out the other documents in my knowledge base for answers to that question.

What is .htaccess again?

If you are not sure what the .htaccess file is, here's a quick info straight from the Apache Configuration Files documentation.

Apache allows for decentralized management of configuration via special files placed inside the web tree. The special files are usually called .htaccess, but any name can be specified in the AccessFileName directive. Directives placed in .htaccess files apply to the directory where you place the file, and all sub-directories. The .htaccess files follow the same syntax as the main configuration files. Since .htaccess files are read on every request, changes made in these files take immediate effect.

For more information check out the Apache tutorial or the link above.

blog comments powered by Disqus
Prev
Next

Powered by FeedBurner Load our "Knowledge Base" feed in your RSS feeder

Follow us on Twitter
Follow us on Facebook
Follow us on LinkedIn
Follow us on Google+

All rights reserved, Adrian World Design ©2009–2022 Powered by Wejas Framework

Jump to Top