Mike, the only way to do it in HTML is using a META Refresh Tag. This would load your HTML file and then redirect to the PHP file. To do this, you have to include the following in your oldpage.htm:
<meta http-equiv="refresh" content="0; URL=http://yourserver.com/newpage.php"> In this case it is wise to delete all other content from oldpage.htm and just leave a "moved" notice and a link to newpage.php on it, just so people don't get confused... Joerg. -----Original Message----- From: Mike Young [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 9:53 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-INST] Need help putting a small pice of code on an html page Actually, I'm using two hosts, one is apache and the other is zeus but I'm slowly moving everything go the apache host. I'll try what you suggested. Although, I was wondering if you could link it like an external css file, something like link href=somefile.php Probably not, haven't tried that but I'll try your suggestion. Thanks --- Joerg Aldinger <[EMAIL PROTECTED]> wrote: > Mike, > > there are several solutions to your problem. Here > are a few: > > ******** 1) Redirect visitors to the new page > To do this, create/modify a .htaccess file in the > directory where your old > page is and include the following line: > > Redirect permanent oldpage.html http://yourserver.com/newpage.php > > This will tell Apache that oldpage.html is no longer > valid and > automatically redirect visitors to the new page. > Note: This only > works if your webserver is Apache, other webservers > probably have this > option elsewhere. See also: > http://httpd.apache.org/docs/mod/mod_alias.html#redirect > > ******** 2) Force PHP parsing of your old file > To do this, create/modify a .htaccess file in the > directory where your old > page is and include the following lines: > > <Location oldpage.htm> > ForceType application/x-httpd-php > </Location> > > This will force apache to process oldpage.htm as a > PHP file. See also: > http://httpd.apache.org/docs/mod/mod_mime.html#forcetype > > ******** 3) Force PHP parsing of all .htm files > This is similar to method 2, but you will need > access to your httpd.conf > file. Open it, and look for the line that says: > > AddType application/x-httpd-php .php > > and then simply add .htm at the end of it: > > AddType application/x-httpd-php .php .htm > > This will tell Apache to send all .htm files on your > server through the > PHP parser. It works, but performance-wise it is not recommended to > send all files through the PHP parser. See also: > http://httpd.apache.org/docs/mod/mod_mime.html#addtype > > IMHO, I believe you should try these options in the > order given, but > depending on your needs you might go with another > option. > > Good luck with that... > > Joerg. > > PS: And yes, [? should be <?php and ?] should be ?> > > -----Original Message----- > From: Mike Young [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 08, 2003 6:13 PM > To: [EMAIL PROTECTED] > Subject: [PHP-INST] Need help putting a small pice > of code on an html page > > > On Fri, Jan 03, 2003 at 11:33:45AM -0800, Mike Young > wrote: > > > > Hi, > > > > I'm new to the list and pretty new to php so > please > > forgive my ignorance. > > > > I came across a piece of php code to redirect > foreign > > countries to a page translated into their language > and > > I wish to put it on an html page. The page has a > > ..htm extension and I don't want to change it to a > .php > > extension because it's in search engines, traffic > > trades etc. But when I put it on my htm page the > code > > shows. I've pasted the code below, just as I found > it. > > > > My question: How can I make this work, after > editing, > > on a page with an htm extension without having to > > change it to a php extension? > > Also , i notice it begins [? and ends ?]. Should > that > > be <? and ?> instead. I assume it should go in the > > body of the page? > > > > As I said I'm pretty new to php so forgive the > > ignorance. Any help would be very much > appreciated. > > Thanks, > > Mike > > > > > > here it is: > > > > PHP FILTERING CODE > > [? > $user_lan = $HTTP_ACCEPT_LANGUAGE; > > if($user_lan=='de') { > ## German > $redir_url = > "http://www.germanlanguagepageurl.com"; > > } elseif($user_lan=='fr') { > ## French > $redir_url = > "http://www.frenchlanguagepageurl.com"; > > } elseif($user_lan=='it') { > ## Italian > $redir_url = > "http://www.italianlanguagepageurl.com"; > > > } elseif($user_lan=='es') { > ## Spain > $redir_url = > "http://www.spanishlanguagepageurl.com"; > > > ## US traffic or Rest of world not defined above > } else { > $redir_url = "http://www.yourmainpageurl.com"; > > } > > header("Location: $redir_url"); > exit; > > ?] > > > > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up > now. > http://mailplus.yahoo.com > > -- > PHP Install Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Install Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP Install Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Install Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php