Jump to content

Recommended Posts

Hey Guys, have recently sorted out a php script with the kind help of your board.

 

I was told that i can get round the problem of having to convert all my .html files to .php ones by setting up a .htaccess file with the following code on it:

 

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

 

But it doesnt seem to be having and effect on the html pages, any ideas as to what i'm doing wrong? I've placed the file in the same directory as the sites files. Plus have contacted the hosters and it's definately an apache server, what am doing wrong???

 

:)

 

cheers guys, peace

 

 

Link to comment
https://forums.phpfreaks.com/topic/135655-htaccess-file-probs-html-to-php/
Share on other sites

Just a shot in the dark, I am not sure if this is possible, but does your host deny your .htaccess file for the AddType? I would think they would be able to but yea, I am not sure.

 

Are you also sure that .htaccess file is at least in the same directory, or one directory above the directory where the files are kept?

 

That code should work just fine, so yea. That is why I am throwing that out there.

well i phoned em up and they agree that it should work lol, they also suggested i try the CPANEL apache handler thing so i put that in to handle it with no joy! This is the source of the .html page:

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Ad rotator test</title>

</head>

 

<body>

 

THIS IS A TEST PAGE<br /><br />

 

<?php require_once("ad_function.php"); ?>

 

 

<?php $ad=ads();

 

Print_r ($ad);

 

?>

 

<br /><br />

<a href="<?php echo $ad['url']['0']; ?>"><img src="<?php echo $ad['ad']['0']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['1']; ?>"><img src="<?php echo $ad['ad']['1']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['2']; ?>"><img src="<?php echo $ad['ad']['2']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['3']; ?>"><img src="<?php echo $ad['ad']['3']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['4']; ?>"><img src="<?php echo $ad['ad']['4']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['5']; ?>"><img src="<?php echo $ad['ad']['5']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['6']; ?>"><img src="<?php echo $ad['ad']['6']; ?>"></img></a><br />

<a href="<?php echo $ad['url']['7']; ?>"><img src="<?php echo $ad['ad']['7']; ?>"></img></a><br />

 

</body>

</html>

 

 

ARGGGHHH!!! :os

 

lol, any ideas??

 

Is it because i'm typing the URL in rather than linking to the .html file i need to be changed to .php?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.