Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We started including some PHP into our web pages, but we wanted to keep our incoming links working. Instead of a bunch of redirects, we simply mapped HTML files to PHP via:

AddType application/x-httpd-php .html

All was well for a few months. Then the the host operators did something to the server (Follow-up: It turned out that the PHP engine was switched), and browsers started downloading the files with the PHP code included (rather than viewing them). They said that we to change our .htaccess file to:

AddType x-httpd-php .html

Is the lack of "application/" newer? Or could they change something again later requiring us to go back?

Is there a more robust way to map .HTML to PHP?

share|improve this question
    
started downloading the files with the PHP code included sounds like PHP was disabled or removed from the web server –  Christopher Wilson Jun 11 '12 at 23:39
    
@ChristopherWilson Removing "application/" did fix the problem, and .php extensions never broke. –  sharoz Jun 12 '12 at 0:14
    
Try using mod_rewrite for this and even look at using it to make your URL friendly. This is all I have done in the past when wanting to do things like this. –  djo Jun 12 '12 at 0:31
    
Looking into it. Thanks! –  sharoz Jun 12 '12 at 2:43

1 Answer 1

up vote 2 down vote accepted

If you are using shared hosting, and you don't control your server, there is always going to be a possibility that the system owner will break something. If you run your own system there is a still a chance something will break, but at least it will break as a result of you doing something. If you setup a good QA infrastructure you can apply updates to a test box before you upgrade the production host allowing you to see what breaks and fix issues before you update the production system.

But yes, it is entirely possible something may change about PHP, or how it is setup on that system in the future breaking that mapping again.

share|improve this answer
    
Thanks for the info! We're a research group hosted by university IT, which is free. But we're considering switching to a private host just for reliability. –  sharoz Jun 12 '12 at 2:46
    
Well complain to the admins for the university web server. Surely they can setup some kind of automated testing, so when they perform upgrades they get alerted when something breaks. –  Zoredache Jun 12 '12 at 4:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.