httpd-wiki-changes mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Httpd Wiki] Update of "HtaccessGotchas" by noodl
Date Fri, 21 Dec 2007 22:11:09 GMT
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 noodl:
http://wiki.apache.org/httpd/HtaccessGotchas

The comment on the change is:
Wrong and somewhat pointless

------------------------------------------------------------------------------
+ deleted
- ## page was renamed from ScratchPad/htaccessGotchas
- ## page was renamed from htaccessGotchas
  
- (!) Consider adding these to the main htaccess wiki page currently here --> [:Htaccess]
(!)
- 
- 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
- {{{
- RewriteRule ^/images/foo.png$ /images/oldfoo.png
- }}}
- working in your main config file and suddenly it stops working when you moved to a shared
hosting and placed it in a .htaccess, try stripping the first /, thus becoming
- {{{
- RewriteRule ^images/foo.png$ /images/oldfoo.png
- }}}
- This happens because .htaccess work in a Directory context (thus the same would have to
be done if the rule was in a <Directory> section)
- 
- (Add the RewriteBase considerations!)
- 

Mime
View raw message