Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

a .htm page that gets content from php.

Need to keep my .htm pages... but have dynamic content

2:36 pm on Apr 5, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Sept 28, 2004
votes: 0

Hi everyone,

I've got a bit of a dilemma - am rebuilding a site with indexed and well ranked pages. I have a lot of .htm pages that are now going to require a bit of dynamic content (log in box / logged in navigation etc). I really want to keep my URL's and not do 301 redirects (a lot of pages!) so was wondering about keeping names as .htm but let web server internally do the work to get content from php.

So basically, we tell web server that when request comes for #*$!#*$!#*$!.htm get content from index.php.... and send that back
This would be done through a rewrite rule..

So, the question is whether or not Google will hammer me for this - or is this a good way of keeping URL's but having dynamic content as well..

Anyone have any thoughts?


2:42 pm on Apr 5, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
posts: 1526
votes: 0

Technically, this can easily be done with a .htaccess file. You don't even need mod_rewrite. Just say HTML files are PHP.

I'm not sure what effects this may have on GPR, but I'll bet it won't have any effect, beyond any changes in the content structure.

2:43 pm on Apr 5, 2007 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 28, 2002
votes: 2

So you are wanting to keep the html pages and basically just include some additional info into them?

If that is all, then you can add

AddType application/x-httpd-php .html

to your .htaccess file.

This tells the server to parse your html files for php. Then simply place some php code within your page as you would a normal php file and it will be parsed.

2:49 pm on Apr 5, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 7, 2003
votes: 0

About 95% of my html pages are html in name only, the source is php. 301 rewrite is really the best solution, IMO. Most redirects on my site could be applied with a regex, but I prefer to write them out anyway.. that's just me.

RewriteRule ^page.html$ http://www.domain.com/php/page.php [L]

It's as simple as that, and leaves me free to worry about things besides how the search engines will treat my pages.

5:16 pm on Apr 5, 2007 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

If there is no redirection going on then you are best served by changing the handler as to invoking the rewrite engine. In PHP5 use AddHandler. PHP4 you may still have to use AddType. Details here ...
8:41 pm on Apr 10, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Mar 30, 2006
votes: 63

What about this? Where I work the sysadmin doesn't allow serverside includes so, there is no way I can use shtml, or worse... the company doesn┐t allow me php so I'm stuck with plain html files.

My solution was to use a perl that shows something when not logged (the login box) and what I want when logged using the document.write("blah blah"); . Visitors don't visit the cgi-bin... but the normal html pages.

This perl prints all of this as a javascript so my html just has the reference to it. I also got some apps working between jsp and plain html this way.

It worked with no problems.