• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

PHP pages

Jog On

Dirty spekulant
Thanks received
188
If I want to use PHP in some of my pages and don't want to faff around too much with Apache handlers can I simply just rename my .html pages to .php?

All the server side scripting stuff is working but the page I want to run the script on has a .html extension - is there anything else I need to consider before just renaming the extension to php?

Also if I do this will it have an adverse affect when the search engines spider my page - ie, will they see it as a new page and I'll have to SEO that new page from square 1?
 
Erm.

You have to tell apache to handle the .php page as a PHP page otherwise it won't work and won't use the apache engine.

If you don't want to change the extension you could tell apache to handle html pages as php pages and just stick the php in there.

A standard html page sent through apache/php will just come out the same as it went in only when it find <?php ?> to process does the page change.
 
Thanks for that - Apache is handling PHP pages OK.

I have used test PHP pages to see if this script works and it does. The problem is with getting PHP to work in pages with a .html extension.

I have set up handlers to tell apache to handle html as PHP but it's not working - even after going through it with my hosting company several times.

That's why I'm just tempted to change the extensions of the html pages to .php - I'm just concerned about:

1. Do I need to do anything else to the pages themselves apart from rename them?

2. If those pages are on the first page of Google/Yahoo/MSN will they get dropped if I change the file extension?
 
have you modified httpd.conf to have something like

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

Yeah I've done that, I did it with an option in my Cpanel there's something up with either the script or my hosting company.

The guy who wrote the script is working on getting html pages to be treated as PHP. I've posted on another forum and had an answer that if I do rename the html files to php they will be treated by the search engines as new files and indexed as new pages so they're staying as html :eek:

I'll just be patient and wait.....
 
Yeah I've done that, I did it with an option in my Cpanel there's something up with either the script or my hosting company.

The guy who wrote the script is working on getting html pages to be treated as PHP. I've posted on another forum and had an answer that if I do rename the html files to php they will be treated by the search engines as new files and indexed as new pages so they're staying as html :eek:

I'll just be patient and wait.....

Could always try adding a index.php and changing the index.html to auto redirect to the index.php.
 
I think I'll just redirect the html pages to the php pages while I split test them until they fix the apache handler thing or whatever it is that's stopping PHP in html pages.

And create .php pages from now on - at least for the ones I intend to split test anyway :nerd
 
You could also try putting the following in an .htaccess file (assuming that apache is serving files):

Code:
<FilesMatch "\.(html)$">
   SetHandler application/x-httpd-php
</FilesMatch>

(assuming you haven't already done this)
 
Last edited: 16:15
Unfortunately I can't use the .htaccess file for things like that now as my hosting company has moved the goalposts somewhat.. :mad

Even with their php.ini file and apache handlers set up in Cpanel it doesn't work.

I'll wait and see if the guy who wrote my split testing script can fix it as I've done everthing the hosting company said to in that thread

Otherwise I'll redirect for the exisiting pages and just write php pages from now on.
 

Advertisers

Back
Top