apache/htaccess: how to avoid redirecting dir to dir/
Posted: Fri Nov 27, 2009 9:27 am
Suppose I have a subdir foo/ on my website.
If I go to http://www.example.com/foo Apache will automatically redirect me (by giving me a 301 Moved Permanently) to http://www.example.com/foo/ (with the slash) and get whatever is inside the foo/ dir (if anything and visible, or an error otherwise).
Now, is there also some .htaccess option or smart rewrite rule that will avoid this?
Well, i could do RewriteRule ^foo$ bar of course, but I mean in general, i.e. for any subdir?
(btw I don't really need this in a practical situation, but stumbled upon this while struggling with another problem, and just wondering)
If I go to http://www.example.com/foo Apache will automatically redirect me (by giving me a 301 Moved Permanently) to http://www.example.com/foo/ (with the slash) and get whatever is inside the foo/ dir (if anything and visible, or an error otherwise).
Now, is there also some .htaccess option or smart rewrite rule that will avoid this?
Well, i could do RewriteRule ^foo$ bar of course, but I mean in general, i.e. for any subdir?
(btw I don't really need this in a practical situation, but stumbled upon this while struggling with another problem, and just wondering)