By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,403 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,403 IT Pros & Developers. It's quick & easy.

Extensions other than .php

P: n/a
I'm trying to create a .txt file on my server that will log the IP,
user agent, and referrer of people who access it, and send back
different contents based on the user agent. The file has to have the
..txt extension because there are already links to the file on other web
sites where I can't change the link URL. Is it possible to have PHP
interpret files with extensions other than .php?
It would also be useful for finding out when other sites refer to files
on my server instead of copying the file to their server.

Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On 27 May 2005 13:12:45 -0700, "DJ Craig" <sp**@djtricities.com> wrote:
I'm trying to create a .txt file on my server that will log the IP,
user agent, and referrer of people who access it, and send back
different contents based on the user agent. The file has to have the
.txt extension because there are already links to the file on other web
sites where I can't change the link URL. Is it possible to have PHP
interpret files with extensions other than .php?
It would also be useful for finding out when other sites refer to files
on my server instead of copying the file to their server.


It's a webserver configuration issue, not PHP. Which are you running?

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
On Fri, 27 May 2005 13:12:45 -0700, DJ Craig wrote:
I'm trying to create a .txt file on my server that will log the IP,
user agent, and referrer of people who access it, and send back
different contents based on the user agent. The file has to have the
.txt extension because there are already links to the file on other web
sites where I can't change the link URL. Is it possible to have PHP
interpret files with extensions other than .php?
It would also be useful for finding out when other sites refer to files
on my server instead of copying the file to their server.


For Apache2 server you should put

AddType application/x-httpd-php .txt

into your httpd.conf.


--
Demagogue: One who preaches a doctrine he knows to be untrue to
men he knows to be idiots.
H.L. Mencken

Jul 17 '05 #3

P: n/a
A better way would be to use Apache's mod_rewrite.

http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html

ECRIA
http://www.ecria.com
Jul 17 '05 #4

P: n/a
Mladen Gogala wrote:
For Apache2 server you should put

AddType application/x-httpd-php .txt


how come you don't stick with the conventional <.php> in
filenames?

--
Jock
Jul 17 '05 #5

P: n/a
On Sun, 29 May 2005 18:08:38 +0000, John Dunlop wrote:
Mladen Gogala wrote:
For Apache2 server you should put

AddType application/x-httpd-php .txt


how come you don't stick with the conventional <.php> in
filenames?


I do stick with ".php". I just answered the original poster's question.
I have no idea why would one do a thing like that, but he asked the
question.

--
Demagogue: One who preaches a doctrine he knows to be untrue to
men he knows to be idiots.
H.L. Mencken

Jul 17 '05 #6

P: n/a
Mladen Gogala wrote:
I have no idea why would one do a thing like that, but he asked the
question.


don't you want to know why?

--
Jock
Jul 17 '05 #7

P: n/a
I'm using Linux. Heres that it says when I type uname -a:
Linux imhip11.aitcom.net 2.4.26 #2 SMP Fri Jul 9 18:41:20 EDT 2004 i686
unknown
I'm using Apache. Not sure what version. How do I find out?

Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.