Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change 
notification.

The following page has been changed by jink:
http://wiki.apache.org/httpd/ScratchPad/htaccessGotchas

The comment on the change is:
added a new topic

------------------------------------------------------------------------------
  
  (!) Consider adding these to the main htaccess wiki page currently here --> 
[["ScratchPad/htaccess"]] (!)
  
- There are a couple of things you must write differently when using .htaccess 
instead of main configuration files. Here's a listing of (currently) only one 
:-)
+ There are a couple of things you must write differently when using .htaccess 
instead of main configuration files. Here's a listing.
+ 
+ === .htaccess location ===
+ When you enable .htaccess files for a certain directory, with AllowOverride, 
then for that directory and all subdirectories of that directory, the 
AllowOverride will apply.  This is probably what you expected, so nothing wrong 
with that.  However, when looking for a .htaccess file, apache will look for a 
file in the directory you access, but it will look for .htaccess files in its 
parents, too!
+ 
+ Examples:
+ 
+ {{{
+ <VirtualHost *:80>
+   ServerName example.com
+   DocumentRoot /var/www/example/
+ 
+   <Directory /var/www/example/>
+     AllowOverride All
+   </Directory>
+ </VirtualHost>
+ }}}
+ 
+ This will allow you to put use .htaccess files on content inside the 
/var/www/example/ directory (ie: on the http://example.com/ site).  This 
applies to /var/www/example/images/ or http://example.com/images/ too, for 
example.
+ 
+ On the other hand, when you access http://example.com/images/, apache will 
look for .htaccess files in these locations in the following order:
+  1. /var/www/example/images/.htaccess
+  1. /var/www/example/.htaccess
+  1. /var/www/.htaccess
+  1. /var/.htaccess
+  1. /.htaccess
  
  === RewriteRules ===
  The part given as argument to a RewriteRule is stripped from the trailing /, 
so, if you have a rule like

Reply via email to