Forum Moderators: coopster
So, with the little bit of PHP learning I've done, I got includes to work just fine and it's all perfect for what I need it for.
The only problem is, all of the pages have to be whatever.php and whatever2.php in order for it to work. Thing is, I'd prefer if all of the pages on this site were whatever.html and whatever2.html.
So my question is, is something like this possible, and, if so, how can I make it happen?
Thanks.
Here's what I've come up with, please let me know if I am understanding it all correctly.
I need to add this line to my .htaccess file: AddType application/x-httpd-php .html
Doing so will allow me to create every page of my site with a .html file extension. And, I'll be able to use php includes in these .html files.
Sound about right?
Another question, is there anything I should be concerned about when doing this? Does it always work? Will it slow down page loading? Is doing this (for the specific purpose of using php includes) fairly common?
Thanks, and again... sorry for forgetting to search first.
Another question, is there anything I should be concerned about when doing this? Does it always work? Will it slow down page loading? Is doing this (for the specific purpose of using php includes) fairly common?
What you are doing is telling the server to parse all files with the extension .html as php files. This will increase the work the server has to do. I suppose for a high traffic site where the majority of .html files were in fact static the increase in load might be significant. For the rest of us it's a sensible solution IMO.
[edited by: ytswy at 7:41 pm (utc) on Aug. 20, 2007]
>> Sound about right?
yes
>> is there anything I should be concerned about when doing this?
not really
>> Does it always work?
most of the time though I have seen problems, we'll see ;)
>> Will it slow down page loading?
not by any amount that is significant
>> Is doing this fairly common?
definitely, I am sure you will find other uses for php as time goes on. From an SEO standpoint it is better to preserve page names so this is what I always suggest, as opposed to changing all the page names you want to use includes with.