Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-05-2006, 07:47 PM   PM User | #1
mark87
Senior Coder

 
Join Date: Dec 2004
Location: Essex, UK
Posts: 2,636
Thanks: 0
Thanked 0 Times in 0 Posts
mark87 is on a distinguished road
Serve Different File Extensions

I've seen some sites (can't find an example at the moment) where for instance a .txt file is displayed as a html page.

How do they do that? Is it something with Apache?
__________________
markaylward.co.uk
mark87 is offline   Reply With Quote
Old 01-05-2006, 08:14 PM   PM User | #2
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Yup, either set in the main Apache httpd.conf or more likley in .htaccess, eg:

Code:
AddType text/html .txt
AddType application/x-httpd-php .magic .cool
Makes .txt files act as HTML, and .magic and .cool files act as PHP.
missing-score is offline   Reply With Quote
Old 01-05-2006, 08:15 PM   PM User | #3
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
It is basically just changing what encoding the server says a certain file is when it serves it up. You can do it with Apache and IIS. Though doing such a thing isn't necessarily a recommended idea since it would just add a layer of ambiguity to the site if someone else needed to work on it.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 01-05-2006, 08:18 PM   PM User | #4
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Quote:
Originally Posted by oracleguy
It is basically just changing what encoding the server says a certain file is when it serves it up. You can do it with Apache and IIS. Though doing such a thing isn't necessarily a recommended idea since it would just add a layer of ambiguity to the site if someone else needed to work on it.
Didn't realise you could do it with IIS (but then again, ive never touched IIS).

Alot of sites use it to hide the server technology they are using, for example make all .html pages parse as PHP or ASP, but I agree, it can add a bit of confusion if anyone else ever has to edit it.
missing-score is offline   Reply With Quote
Old 01-05-2006, 08:20 PM   PM User | #5
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Quote:
Originally Posted by missing-score
Didn't realise you could do it with IIS (but then again, ive never touched IIS).
Well you can't use your .htaccess method on IIS to do it but it certainly can be re-configured through the MMC to do the exact same thing.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 01-05-2006, 08:21 PM   PM User | #6
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Quote:
Originally Posted by oracleguy
Well you can't use your .htaccess method on IIS to do it but it certainly can be re-configured through the MMC to do the exact same thing.
Ahh right, sorry, I guessed you could do something like it on IIS but I thought you meant it was exactly the same
missing-score is offline   Reply With Quote
Old 01-05-2006, 08:31 PM   PM User | #7
mark87
Senior Coder

 
Join Date: Dec 2004
Location: Essex, UK
Posts: 2,636
Thanks: 0
Thanked 0 Times in 0 Posts
mark87 is on a distinguished road
Ah thanks, I thought it would be an Apache thing but couldn't find anything related to it from searching! Ooh, now I can have cool file extensions!
__________________
markaylward.co.uk
mark87 is offline   Reply With Quote
Old 01-06-2006, 05:20 PM   PM User | #8
mark87
Senior Coder

 
Join Date: Dec 2004
Location: Essex, UK
Posts: 2,636
Thanks: 0
Thanked 0 Times in 0 Posts
mark87 is on a distinguished road
Hmm, this works for the .JPG but not the .XHTML ? (I was just playing about with it ! )

AddType application/xhtml+xml .xhtml .jpg
__________________
markaylward.co.uk
mark87 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:25 AM.


Advertisement
Log in to turn off these ads.