Hi all, been a while since I've posted here but I'm having a problem and you're the sort of people who should be able to help me out. I am running EasyPHP 5.3.9, and am a bit of a newbie to .htaccess. I am developing the application locally, so the URL to my site's root (as I'm using an alias) is http://127.0.0.1/Example/, which contains index.php and my .htaccess file, as well as a subdirectory "src". src contains a number of other subdirectories (such as one for PHP classes, one for images, one for page templates, one for CSS files, one for JS files, etc.) All PHP files that are included by index.php respond with a 403 error if accessed directly. I want to to redirect those to index.php?page=error403 via use of ErrorDocument in the .htaccess file. If someone attempts to access a file that's not there I want a similar 404 error (which works fine currently). Additionally, I've managed to get my RewriteRules such to work with clean URLs. Commenting it out doesn't seem to affect any of the ErrorDocument stuff, but I've included it just in case there's some subtlety I'm missing. My 404 errors work fine. My 403 errors for trying to access the directories themselves work fine. My 403 errors for trying to access the PHP files do not work fine, and give a standard 403 response: My .htaccess file (stored in http://127.0.0.1/Example/) is: # PREVENT DIRECTORY LISTING Options -Indexes # ERROR DOCUMENTS ErrorDocument 403 /Example/index.php?page=error403 ErrorDocument 404 /Example/index.php?page=error404 # CLEAN URLS # note anything in src directory is not cleaned RewriteEngine On RewriteCond %{REQUEST_URI} !^/Example/src(/.*)?$ RewriteRule ^([a-z0-9]+)/?$ /Example/index.php?page=$1 [L,NC] RewriteCond %{REQUEST_URI} !^/Example/src(/.*)?$ RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/?$ /Example/index.php?page=$1¶m=$2 [L,NC] RewriteCond %{REQUEST_URI} !^/Example/src(/.*)?$ RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/?$ /Example/index.php?page=$1¶m=$2¶m2=$3 [L,NC] # Ignore clean URLs more than three deep RewriteCond %{REQUEST_URI} !^/Example/src(/.*)?$ RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/.+$ /Example/index.php?page=$1¶m=$2¶m2=$3 [L,NC] # PREVENT ACCESS TO .HTACCESS FILES <Files .htaccess> order allow,deny deny from all </Files> Code (markup): If I have failed to clarify anything correctly, please let me know. Additionally, if you can see a way to write my .htaccess file better, feel free to shout out. I should add that, once deployed, it will be accessible at http://example.com/Example/, so hopefully it parallels well. Many thanks!