Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

While I understand that this is a minor issue, I have wondered whether it is possible to disable redirects on directory urls in Apache2.

Currently, when connectiong to http://localhost/cgi, apache2 would redirect to http://localhost/cgi/, since $WEBROOT/cgi is a directory:

$ curl --head http://localhost/cgi
HTTP/1.1 301 Moved Permanently
Date: Fri, 20 May 2011 05:01:31 GMT
Server: Apache/2.2.17 (Ubuntu)
Location: http://localhost/cgi/
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1

The reason I ask is because of a flaky connection to my webserver, where it usually takes an arguably long time to connect. I'd like to avoid unnecessary requests if possible.

Is there a way to disable this behaviour, so when connecting to http://localhost/cgi Apache would not attempt to redirect?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You can turn it off with the DirectorySlash directive in your config.

http://httpd.apache.org/docs/2.0/mod/mod_dir.html

share|improve this answer
    
Neat, although the security warning is kind of a party pooper (also I can't upvote due to lack of reputation) :( –  hiobs May 20 '11 at 8:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.