Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > Apache Help

Apache Help Post any question relating to Apache here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-11-12, 08:47 PM
Junior Member
 
Join Date: Nov 2006
Posts: 1
jonwade is on a distinguished road
Default using htaccess to allow html pages to be parsed as php - I cannot get it to work !

Hello,

I am planning to rebuild my website with header.htm, foot.htm, menu.htm files etc and using php includes within my exisiting .html files. I have been informed that php can be parsed my html pages as php by adding a rule to the .htaccess file, and have found several codes to use, but so far have been unable to get any of them to work. They either result in a request to download and save pages rather than show in the browser, or they do nothing.

The codes I have tried are:

AddType application/x-httpd-php .htm .html
-- results in attempted download

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
- results in attempted download

AddType x-httpd-php .php .htm .html
AddHandler application/x-httpd-php .php .htm .html
-- prevents php being read in php file (e.g. http://www.tranquillizer.co.uk/suppl...ey-protein.php)
and does nothing for .html file (e.g. http://www.tranquillizer.co.uk/phptest.html)

AddType x-mapp-php4 .html .htm (suggested by web host)
results in some pages as Error 404 not found (pages for which the link has no extension I think)


My server is with 1and1, and so far they have not given a response to my problem. As a last resord I will have to rename all pages as .php and set up permanent redirects, but I have been informed that this may affect page ranking etc.

Does anyone have any suggestions? I do not have access to the Apache config files with my webhost.

If you are with 1and1 and have done this, please let me know !

Thanks,

Jon.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2006-11-13, 12:06 AM
Senior Member
 
Join Date: Jul 2006
Location: Prague, Czech Republic
Posts: 193
vladimir_cz is on a distinguished road
Send a message via ICQ to vladimir_cz Send a message via MSN to vladimir_cz Send a message via Yahoo to vladimir_cz Send a message via Skype™ to vladimir_cz
Default

You can use mod rewrite for silently call .php files when .htm file requested.
__________________
Thank you. Vladimir, Czech Republic.
http://www.smartwebco.com/
I'm looking for job.
Reply With Quote
  #3 (permalink)  
Old 2007-02-27, 07:36 AM
Junior Member
 
Join Date: Feb 2007
Location: Philippine islands
Posts: 1
hans51 is on a distinguished road
Send a message via ICQ to hans51
Default

if you still have that problem open until now
i was hosted at 1and1.com until october 2006 and had it all successfully running until 1and1 ran out of resources and i moved to root server

i checked one of my old backups for u and found my entries in .htaccess

AddType x-mapp-php4 .html .htm .shtml
removeHandler server-parsed shtml


if u have php5 then you have to change first lien above accordingly

good luck
Reply With Quote
  #4 (permalink)  
Old 2007-03-07, 11:01 AM
Junior Member
 
Join Date: Mar 2007
Posts: 1
karthikeyanr23 is on a distinguished road
Default To parse html pages as php

Hi jonwade,

You want apache to parse html as php right? This can be set by putting the following code in ".htaccess"

1. edit .htaccess file

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

This will do the trick.

If you want more extension to be parsed as php you can add as much

eg:

AddHandler application/x-httpd-php .php .phtml .html .htm .shtml .cgi .pl .asp .dll


Regards,
Karthikeyan.R
Reply With Quote
  #5 (permalink)  
Old 2007-06-03, 07:49 AM
Junior Member
 
Join Date: Jun 2007
Posts: 1
weesel is on a distinguished road
Default

Quote:
Originally Posted by hans51 View Post
if you still have that problem open until now
i was hosted at 1and1.com until october 2006 and had it all successfully running until 1and1 ran out of resources and i moved to root server

i checked one of my old backups for u and found my entries in .htaccess

AddType x-mapp-php4 .html .htm .shtml
removeHandler server-parsed shtml


if u have php5 then you have to change first lien above accordingly

good luck
I found this page thru google, looking for better info about the "application/x-httpd-php" type found on other sites, but I couldn't make it work. The above lines worked perfectly on my shared server at 1and1. Thanks hans51!
Reply With Quote
  #6 (permalink)  
Old 2007-11-06, 11:01 AM
Junior Member
 
Join Date: Nov 2007
Posts: 1
GardenSimply is on a distinguished road
Default

Vladimir,

How would one do what you suggested?

I have a bit of a different problem, but somewhat the same, LOL

I have a site I am changing over from ssi to php I would like to keep the .shtml file name as they are indexed well. When I place

Addhandler application/x-httpd-php .html .php .shtml

in .htaccess, php is of course parsed just fine. The problem is that the pages that still use ssi are not functioning. I don't have time to get all the pages done at once, it is a process that is going to take a few weeks.

IF I add the .shtml to the list above, it won't put the ssi in, but if I leave it out, it will not parse the php on the .shtml pages that are updated with php includes.

Is there any way to get the .shtml pages to provide the server side includes OR the php includes while using the .shtml extension?

You can see it at Sustainable organic gardening for food.

The site is hosted running php5.2.4 and Apache 1.3.39

Last edited by GardenSimply; 2007-11-06 at 11:03 AM.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:06 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.