homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Apache serving up my text files even though no .txt in URL?

10+ Year Member

Msg#: 3976145 posted 2:16 am on Aug 21, 2009 (gmt 0)

Hi everyone,

I am pulling my hair out...well...what I have left up there somewhere trying to figure out why Apache is behaving as it is and would appreciate any insight from anyone on this problem. I have been at it for several hours and for the life of me can't figure this out.


I have a bunch of text files in my public directory. These text files end in the extension .txt All well and good. These files get spit out as web pages by some PHP scripts that I have.

Okay that's the background.

Now when I enter a URL like <some domain>/home for example Apache pulls up the <some domain>/home.txt file. If I enter <some domain>/about-me it pulls up the <some domain>/about-me.txt file and displays the plain text contents on the screen.

I have no .htaccess file (I renamed it while trying to create some mod_rewrite rules that led me to realize this was happening).

This is a test server so none of the usual cautions apply here as to what I am doing.

Why does Apache insist on adding an extension to my URL's?

I think it has something to do with a default mime but I can't seem to find anything on this yet and would appreciate some input.

How to I tell Apache not to assume anything and only pull up what is explicitly indicated in the URL and nothing else?





WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 3976145 posted 11:33 am on Aug 21, 2009 (gmt 0)

Are you sure these aren't just being served by your browser cache? Clear the cache and try again.

Are you sure this is a redirect? Use the 'Live HTTP Headers' extension for Firefox to look at the server response codes.


WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 3976145 posted 2:48 pm on Aug 21, 2009 (gmt 0)

Disable content-negotiation (MultiViews) by adding the directive
Options -MultiViews
to your top-level .htaccess file, and see if that helps.

This is the most-likely fix, based on what you wrote. If you can't or don't want to do this, ask your host to do it for you, either in .htaccess or in the server config file.

Note that .htaccess must be a plain-text file, so use a simple plain-text editor such as Microsoft Notepad to create or edit the file, not a word-processing program or an HTML editor!



10+ Year Member

Msg#: 3976145 posted 5:20 pm on Aug 21, 2009 (gmt 0)

Thanks very much for the input!

I managed to figure out with another hour or two of digging around. It was indeed MultiViews! I turned it off and presto...the text files stopped being served up unless I explicitly put the full name (with extension) in the URL.

I apparently disabled MultiViews a long time ago at my web hosting provider (unless they did) because after I was done with changes to my site locally and uploaded them to my server...it worked just fine.

Thanks again! Your input is much appreciated.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved