January 28th, 2012, 04:50 AM
Force html as php pages in htaccess
If somebody please can explain,
I have in my htacces telling apache to treat all html pages as php,
I just read in a hosts instructions to avoid doing that as it takes a lot of cpu resources, and my problem is cpu resources...
They say this;
AddHandler application/x-httpd-php5 .html .htm
It is highly recommended that you never allow html pages to automatically handle php or shtml, because this forces all of your html pages to be processed by the server first. Instead, please rename your files to .php or .shtml whenever possible.
I wonder if this is true, as I can do a redirect not to loose my backlinks but I dont want to change index.htm to index.php as it been that way for then years.
So what can I do?
1st, I could call all new pages .php instead of .htm,
however dont know if site looks funny having some pages with name .htm and other with .php?
2nd. I could rename all pages to .php that are not important and dont have backlinks, that way apache dont have to force html to php on all pages.
However I dont use addhandler but suppose its the same, forcing apache:
AddType application/x-httpd-php5 .htm .html
Last edited by helenp; January 28th, 2012 at 09:40 AM.
January 28th, 2012, 12:06 PM
If all of your html files contain PHP then renaming them to .php won't change anything.
You would only be able to realize a performance improvement if some of your files contained pure-HTML and others contained PHP/HTML. In that case, you should distinguish between them by naming your pure HTML files with a .html or .htm extension, and naming your PHP/HTML files with a .php extension; then disable processing of HTML files as PHP. The server will then be able to serve the pure-HTML files as pure-HTML, which is significantly faster than serving them as PHP. Your PHP/HTML files will still be served as PHP, so there will be no performance difference there.
January 28th, 2012, 12:11 PM
How many of your .htm and .html files don't have any PHP code in them?
They just don't want you to waste server resources by making the PHP parser be used when it's not really needed.
Yes, it has the same affect.
January 28th, 2012, 01:11 PM
No I think all pages have php as I have a searcherbox in all pages, so there is nothing I can do there then.