Forum Moderators: coopster

Message Too Old, No Replies

PHP or ASP called in .html files?

         

bobjen

6:00 pm on May 12, 2005 (gmt 0)

10+ Year Member



Hi,

I would like to create a content rotator script that can be included in an html file, so that the content can be spidered by the search engines. Therefore, javascript is out of the picture. Does anyone know how to execute a php or asp script inside an html file? Or is there some way to include dynamic content that is visible to a spider as static content on an html page? Or do search engines list and rank php and asp pages as frequently or as well as they do .html files?

Thanks,
Jenn

kazecoder

7:30 pm on May 12, 2005 (gmt 0)

10+ Year Member



Jenn,

It sounds like you want to do some sort of a include. This is possible with both php and asp as you mentioned and it appears as regular code to the search engines. In order for this to work correctly the page will have be be named with a .php or .asp extension otherwise the server will not interpret the code and it will be treated as regular text.

In either language includes are simple. Here is a php version:

<?php include("page.php");?>

mcavic

7:54 pm on May 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unless your web server is specially-configured, you will need to use the .php or .asp extension. Search engines should treat those just as well as .html.

coopster

12:00 am on May 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, bobjen.

You can indeed have your pages named .htm or .html or better yet, with no extension at all. As the folks have stated, it depends on how you have your server configured.

bobjen

2:10 am on May 14, 2005 (gmt 0)

10+ Year Member



Are you referring to a mod rewrite in the .htaccess file? Can someone tell me how to do this specifically?

Thanks,
Jenn

coopster

8:27 pm on May 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



No, you don't need mod-rewrite. You can simply use an AddHandler or AddType directive. There was a recent thread in the Apache Forum discussing how to change .html to .php [webmasterworld.com] or a search over this forum will turn up plenty of discussion.