Page 2 of 2
Re: Renaming *.html to *.php
Posted: Mon Oct 27, 2008 1:47 pm
by Vegan
Would Apache as default be able to notice:
<script language='php' type="text/???"> echo '<p>Can U see me?</p>'; </script>
This would simplify installing widgets generally. I am borrowing from the JavaScript idea.
Re: Renaming *.html to *.php
Posted: Sat Apr 25, 2009 8:29 pm
by Vegan
scottayy wrote:There's a bunch of crap in this topic, LOL. Well not necessarily crap, but just beating around the bush.
Just rename your .html extensions to .php extensions and you can put php code in any of them.

Simple.

Don't worry about the .htaccess part, or search engine ranking.
I've had fairly busy web sites (upwards of 200,000 page loads per day) on a pretty normal server and server load never became a problem. I've also had .php pages rank well (and yes, in google).
Keep it simple.

Thanks for the clarification. I have since added JSP to the mess to see if I can figure out that as well.
The way I see it now, old documents are HTML, new active ones will be PHP or JSP as needed. Only recently been working more with Linux and active content. Seems to be a lot to learn.
I prefer the simplest solutions as they tend to be adequate. My sites are nowhere near that busy but some day? I wish.
Re: Renaming *.html to *.php
Posted: Sat Apr 25, 2009 9:23 pm
by McInfo
There is a way to get around the problem of broken links caused by making structural changes to your website (like changing all .html extensions to .php or moving files to different folders). In your 404 page (ex: missing.php), create a script that analyzes the incoming REQUEST_URI and tries to match it with an existing file. If a match is found, redirect to the matched page.
Edit: This post was recovered from search engine cache.
Re: Renaming *.html to *.php
Posted: Sun Apr 26, 2009 1:40 am
by coalgames
This is a little confusing to follow.
But a quick solution is to just go like this:
Code: Select all
<?php
$randomly_generated_number = rand(1,3);
switch ($randomly_generated_number) {
case 1:?>
<some><html></here>
<?php
break;
case 2:?>
<some><other><html></here>
<?php
break;
case 3:?>
<some><another><html></here>
<?php
}
?>
Kinda messy but can get the job done.
Then, if you are using a shared host, the php will be parsed inside html if there are <?php and ?> tags.