/    Sign up×
Community /Pin to ProfileBookmark

.htaccess question

Hi,

I have a directory with lots of .htm / .html files, and want only one or two of them to be treated as .php files. If in .htaccess I put something like this

[CODE]AddType application/x-httpd-php .html .htm[/CODE]

, it affects all the files with the specified extensions.

Is it possible to do this say only for test1.htm and test2.htm, and leave the rest of *.htm* files in the same directory unaffected?
(I don’t want to move the files to a separate folder, and using wildcards like [B]*test*.htm[/B] has no effect)

Thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@DasherFeb 18.2012 — Yes! You can do that with a regular expression. I am not real good on those so someone else may provide a specific solution.
Copy linkTweet thisAlerts:
@eval_BadCode_Feb 18.2012 — Something like this:

[CODE]
<Files foo.htm>
AddHandler x-httpd-php5 .htm
</Files>
<Files bar.html>
AddHandler x-httpd-php5 .html
</Files>
[/CODE]
×

Success!

Help @peter_nn0 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 5.7,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...