Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

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



2:16 am on Aug 21, 2009 (gmt 0)

10+ Year Member

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?




11:33 am on Aug 21, 2009 (gmt 0)

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

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.


2:48 pm on Aug 21, 2009 (gmt 0)

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

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!



5:20 pm on Aug 21, 2009 (gmt 0)

10+ Year Member

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.



Featured Threads

Hot Threads This Week

Hot Threads This Month