homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Marketing and Biz Dev / Cloaking
Forum Library, Charter, Moderator: open

Cloaking Forum

a .htm page that gets content from php.
Need to keep my .htm pages... but have dynamic content

10+ Year Member

Msg#: 3303258 posted 2:36 pm on Apr 5, 2007 (gmt 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?




WebmasterWorld Senior Member 10+ Year Member

Msg#: 3303258 posted 2:42 pm on Apr 5, 2007 (gmt 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.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 3303258 posted 2:43 pm on Apr 5, 2007 (gmt 0)

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.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 3303258 posted 2:49 pm on Apr 5, 2007 (gmt 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.


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

Msg#: 3303258 posted 5:16 pm on Apr 5, 2007 (gmt 0)

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 ...


WebmasterWorld Senior Member 5+ Year Member

Msg#: 3303258 posted 8:41 pm on Apr 10, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Marketing and Biz Dev / Cloaking
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved