Forum Moderators: phranque

Message Too Old, No Replies

Can Apache be prevented from appending a slash

if the folder with the same name exists

         

true_INFP

4:03 pm on Mar 21, 2009 (gmt 0)

10+ Year Member



If I don't want Apache to auto-append a slash to every URL whose final portion matches an existing folder name, is there a way to do it?

For instance:

If a folder called 'document' exists in the root directory, then:

http://www.example.com/document is redirected to:
http://www.example.com/document/

Is there a way to disable that redirection?

Thanks.

true_INFP

4:06 pm on Mar 21, 2009 (gmt 0)

10+ Year Member



BTW, I use Apache 2.2.

PS - Please don't suggest any workarounds or reasons why I shouldn't do that. I just need an answer to the question.

jdMorgan

4:25 pm on Mar 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not clear what "the big picture" looks like here. I assume that you're using extensionless URLs to refer to files, and that mod_dir is kicking in and appending a slash, thereby mapping your extensionless file URLs to existing directories before they can be mapped to the correct files.

It sounds like either your existing extensionless_URL-to-file_with_extension mapping function (mod_rewrite?) is incorrect, or perhaps mod_speling, mod_negotiation, or AcceptPathInfo is interfering with that mapping function.

Jim

Caterham

5:35 pm on Mar 21, 2009 (gmt 0)

10+ Year Member



If I don't want Apache to auto-append a slash to every URL whose final portion matches an existing folder name, is there a way to do it?

See the DirectorySlash [httpd.apache.org] directive.

[edited by: jdMorgan at 5:39 pm (utc) on Mar. 21, 2009]
[edit reason] speling [/edit]

true_INFP

5:45 pm on Mar 21, 2009 (gmt 0)

10+ Year Member



Yes, I found it in the meantime. Thanks.