JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
disable server-side code except wfpl_main.php
[wfpl-cms.git] / .htaccess
index 7ba7ac4..173e9bf 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -2,14 +2,32 @@ php_value post_max_size 25M
 php_value upload_max_filesize 20M
 php_flag register_globals off
 php_flag magic_quotes_gpc off
-Options -MultiViews
 DirectorySlash Off
 DirectoryIndex disabled
 AddDefaultCharset UTF-8
+AddCharset UTF-8 .css
 RewriteEngine  on
 RewriteRule    ^[^/.]*$  /wfpl_main.php [L]
+# Close loophole in security restriction/exception below
+RewriteRule    ^.*/.*wfpl_main.php$  /wfpl_main.php [L]
 
 <FilesMatch "\.(css|jpg|png)$">
        ExpiresActive On
        ExpiresDefault A31536000
 </FilesMatch>
+
+# SECURITY: don't execute code on the server (exception below)
+SetHandler none
+SetHandler default-handler
+# this option is needed for RewriteRule to work:
+Options SymlinksIfOwnerMatch
+php_flag engine off
+RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo
+# Exception: allow access to wfpl_main.php
+#
+# this allows access to any files named "wfpl_main.php" anywhere, so there's a
+# rewrite rule above to use teh top-level one, no matter which was requested.
+<Files "wfpl_main.php">
+       php_flag engine on
+       SetHandler application/x-httpd-php
+</Files>