/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] .htaccess deny php

using an .haccess file, how can I disable php in a certain directory, and all of the sub directories of that directory?

If possible (but not necessary) I would like to out put the files as if they were txt files.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 11.2007 — You can use the following to have any .php files output through the highlight_file function instead of being processed as PHP scripts:
<i>
</i>AddType application/x-httpd-php-source .php
Copy linkTweet thisAlerts:
@The_Little_GuyauthorOct 11.2007 — is that the only line I need, because it doesn't work.
Copy linkTweet thisAlerts:
@NogDogOct 11.2007 — Worked OK for me. Don't know if it will make a difference, but you could try a RemoveType first:
<i>
</i>RemoveType .php
Copy linkTweet thisAlerts:
@The_Little_GuyauthorOct 11.2007 — I looked at my host's wiki, and they show this:
Here is the mime.types file DreamHost currently uses to register mime-types with Apache:[/QUOTE]

this was in the list:

[B]application/x-httpd-php-source phps[/B]
Copy linkTweet thisAlerts:
@The_Little_GuyauthorOct 11.2007 — OK... I contacted support, and they were able to fix my problem!!

the final .htaccess file:
RemoveType .php
AddType application/x-httpd-php-source .php
AddHandler application/x-httpd-php-source .php
×

Success!

Help @The_Little_Guy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...