diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..57dac95
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,45 @@
+# This file sets up the necessary PHP settings to run KnowledgeTree
+# optimally.
+#
+# It is best that KnowledgeTree be allowed to manage its PHP and access
+# permissions using these .htaccess files. This prevents direct access
+# to libraries, scripts, and documents that should not be available via
+# the web.
+#
+# By default, to facilitate quick testing of functionality,
+# KnowledgeTree places the Documents directory within the KnowledgeTree
+# web root. This, by default, would allow people to browse the
+# documents in the DMS, bypassing the security permissions. The
+# default .htaccess settings would prevent this.
+#
+# KnowledgeTree itself is able to deal with most PHP configurations,
+# excepting "safe mode" currently, but is unable to handle certain
+# inherent configuration options (for example, setting the upload size
+# very low). Check the setup checklists (as described in the
+# documentation) to see how your configuration is handled.
+#
+# The default .htaccess settings ensure that no workarounds occur in the
+# PHP code, leading to better performance and robustness.
+#
+
+php_value upload_max_filesize 8M
+php_value post_max_size 8M
+php_value memory_limit 8M
+php_value max_input_time -1
+php_value max_execution_time 60
+php_value default_mimetype text/html
+php_value auto_prepend_file none
+php_value auto_append_file none
+php_flag display_startup_errors ON
+php_flag display_errors ON
+php_flag file_uploads ON
+php_flag magic_quotes_gpc OFF
+php_flag magic_quotes_runtime OFF
+php_flag register_globals OFF
+php_flag output_buffering OFF
+php_flag session.auto_start OFF
+
+
+SetEnv kt_htaccess_worked yes
+
+LimitRequestBody 0
diff --git a/Documents/.htaccess b/Documents/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/Documents/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/bin/.htaccess b/bin/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/bin/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/config/.htaccess b/config/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/config/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/docs/.htaccess b/docs/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/docs/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/etc/.htaccess b/etc/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/etc/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/lib/.htaccess b/lib/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/lib/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/log/.htaccess b/log/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/log/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/pear/.htaccess b/pear/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/pear/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/phpSniff/.htaccess b/phpSniff/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/phpSniff/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/phpmailer/.htaccess b/phpmailer/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/phpmailer/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/sql/.htaccess b/sql/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/sql/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/sync/.htaccess b/sync/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/sync/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all
diff --git a/tests/.htaccess b/tests/.htaccess
new file mode 100644
index 0000000..93169e4
--- /dev/null
+++ b/tests/.htaccess
@@ -0,0 +1,2 @@
+Order deny,allow
+Deny from all