Apache HTTPD: "client denied by server configuration: .htaccess" Even When .htaccess is Blank
Apparently the .htaccess wasn't being read because I didn't allow configuration overrides; if I added "AllowOverride All" to my Virtual Hosts Directory, it worked—except for mod_rewrite, due to the following error:
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden
After I added in Options FollowSymLinks everything worked.
Final code:
<Directory "D:/Path/To/Sites">
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
Related videos on Youtube
Hugh Guiney
Hi, my name’s Hugh Guiney (🗣 GUY-knee). I’m a UX Developer, which means I design and code thoughtful digital products. I’ve worked with organizations of all sizes, from startups to SMBs to household names. In my spare time I build open-source software (check out my interactive video player, RedBlue), play fighting games, and perform improv comedy. Last name is pronounced “GUY-knee”.
Updated on September 17, 2022Comments
-
Hugh Guiney over 1 year
- Windows 7 Ultimate (64-bit)
- Apache HTTP Server 2.2.15 (32-bit)
- PHP 5.3.2 (32-bit)
httpd.conf is default except I uncommented the line for mod_rewrite and the one that loads httpd-vhosts.conf, which looks like this:
# # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.2/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. <Directory "D:/Path/To/Sites"> Options Indexes Order Deny,Allow Allow from all </Directory> # # Use name-based virtual hosting. # NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "D:/Path/To/Site 1" ServerName site1.local ServerAlias www.site1.local ErrorLog "logs/site1.local-error.log" LogLevel debug CustomLog "logs/site1.local-access.log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "D:/Path/To/Sites/Site 2" ServerName site2.local ServerAlias www.site2.local ErrorLog "logs/site2.local-error.log" LogLevel debug CustomLog "logs/site2.local-access.log" common </VirtualHost> <VirtualHost *:80> DocumentRoot "D:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs" ServerName localhost </VirtualHost>
Windows hosts file forwards site1.local and site2.local to 127.0.0.1.
When trying to access site2.local, .htaccess is clearly being ignored. In site2.local-error.log, the ONLY error each time I try to access it is this:
[Wed Jul 21 17:57:06 2010] [error] [client 127.0.0.1] client denied by server configuration: D:/Path/To/Sites/Site 2/.htaccess
But, even when I delete everything in .htaccess, I still get the same error. Moving Directory inside VirtualHost makes no difference; nor does moving the contents of Site 2 to htdocs.