Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Apache read ASP as HTML

Posted on 2011-05-10
10
Medium Priority
?
538 Views
Last Modified: 2012-05-11
i have inherited a site from a windows server and am converting it to MySQL with trying to change very little.

all the nav menus show  .asp (.ASP) files (which mostly are just static html)

is there any way i can instruct Apache to present .asp as an HTML file instead of text file?

At worst case i could do a mod_rewrite to an equivalently named .html

i realize it's a hack, but it's temporary to get the site going quickly.

thanks
0
Comment
Question by:willsherwood
  • 4
  • 4
  • 2
10 Comments
 
LVL 9

Assisted Solution

by:Erdinç Güngör Çorbacı
Erdinç Güngör Çorbacı earned 200 total points
ID: 35733905
You may also consider checking php.ini for ASP tags enabled or not ?

Look for
asp_tags=1
if there is disable it by changing to
asp_tags=0
0
 

Author Comment

by:willsherwood
ID: 35733918
hmmmm.    i'm just looking to have   web page files with the extension .asp
to be presented as if the extension were .html
currently  the web browser shows the text verbatim   as if the file extension were   .txt

please clarify your suggestion, i'm not understanding?
0
 
LVL 9

Expert Comment

by:Erdinç Güngör Çorbacı
ID: 35733957
And i think you can read files with file_get_contents after clearing asp blocks
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Erdinç Güngör Çorbacı
ID: 35733969
in my first post i just wanted to make you sure php is not trying to process asp pages. not anymore ... and this is only if you can reach php.ini
0
 
LVL 9

Expert Comment

by:Erdinç Güngör Çorbacı
ID: 35733978
btw ... you dont need to do these if you will use a rewrite rule ...
0
 

Author Comment

by:willsherwood
ID: 35734005
here is what a simple p.asp file displays as in a browser, identical with the source code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?= "PHP WAS HERE" ?>
HTML XXX
</body>
</html>

Open in new window

0
 
LVL 4

Accepted Solution

by:
a1j earned 1800 total points
ID: 35734202
Enable mod-mime and set required content-type for asp files

http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addencoding

AddEncoding text/html .asp
0
 

Author Comment

by:willsherwood
ID: 35734230
I think this is exactly what i need.
is this setting server-wide or possible to do within a particular directory (via .htaccess)
(once Apache is enabled in general)
0
 
LVL 4

Expert Comment

by:a1j
ID: 35734271
<Location> <Directory> or <File> scope. So .htaccess should be fine probably.
0
 

Author Closing Comment

by:willsherwood
ID: 35734284
thanks all!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question