Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
482 views
in Technique[技术] by (71.8m points)

.htaccess - htaccess rule to parse php in html files not working

can't for the life of me work out why this isn't working - on a dreamhost server, I've created an htaccess file and added AddHandler php5-cgi .html .htm to allow php in html files, as per the dreamhost docs. On an identical dreamhost package, I've done the same thing for another site and it worked perfectly, but in this case it just won't parse the php! Is there anything I could have missed here which could be causing the problem? The htaccess is in the web root and isn't being overridden by anything else.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

try this

  AddType application/x-httpd-php .html .htm

The above setting will work if the apache is picking php as a module.

 AddHandler application/x-httpd-php .html .htm

or

 AddHandler application/x-httpd-php5 .html .htm

above will work if apache is executing php as CGI?

there is no harm i would say to put both of the above conditions together but try one over other and see if it work for you.

read more here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...