Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9611
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: why php echo does not show up in HTML? |
| Date | 2013-05-24 15:34 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <knof3t$um9$1@dont-email.me> (permalink) |
| References | <78f2c263-051b-4b12-b2fc-049aeae3fdd6@z8g2000yqd.googlegroups.com> <af70263f-b09f-49cd-b3e3-95b4c04fe39f@z10g2000yqd.googlegroups.com> <b09pm1FmrntU1@mid.individual.net> |
On 5/24/2013 2:26 PM, J.O. Aho wrote: > On 24/05/13 11:06, steve nospam wrote: > >> I found the problem. >> >> I needed to modify the .htaccess file. added this line >> >> AddType application/x-httpd-php .htm >> >> Now it works. php works from inside htm file. No need to change file >> extension. > > No, you didn't solve anything at all, you just managed to break your > site to not work properly. > > When you add that line, all the pages ending with ".htm" will be sent > trough the PHP parser and the majority of your pages will not include > PHP which means you do something unnecessary by sending them to the PHP > engine which has to read the whole file and do nothing more. > > The fix is rename the files to .php and remove the line from your > htaccess file. If pages which before been called whatever.htm will > suddenly be whatever.php, then use Rewrite rules to redirect the user to > the new page. > > RewriteEngine On > RewriteRule ^whatever.htm$ whatever.php > > Now your site will work at the majority of web hosting companies as you > have your PHP in .php files and RewriteRule is in most cases allowed. > > > Note: When people say you can use PHP in HTML, they ain't talking about > the file extension, but that you can mix plain HTML with PHP code, for > example: > > --- example.php --- > <html> > <head> > <title>example file with mixed php and html</title> > </head> > <body> > <h1><?php echo "this is an example"; ?></h1> > <?php echo "this code is quite stupid, but shows how you can make a > badly coded site"; ?> > </body> > </html> > --- eof --- > This also only bypasses the problem - and will require a redirect for the life of the website (even if he changes hosts). Better is to put in a 301 redirect for the pages; search engines will pick up the redirect and link to the new page. It can be done easily in the .htaccess file (more info on how to do it correctly an alt.apache.configuration). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:08 -0700
Re: why php echo does not show up in HTML? "Andy" <andy@NOSPAMmanyplay.com> - 2013-05-24 09:50 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:25 -0400
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:53 -0700
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:57 -0700
Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:25 +0000
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 02:06 -0700
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 06:20 -0700
Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 14:40 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:55 -0400
Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 16:47 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 12:07 -0400
Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 18:04 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 13:30 -0400
Re: why php echo does not show up in HTML? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-24 22:32 +0200
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:19 -0700
Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:02 +0000
Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:37 +0000
Re: why php echo does not show up in HTML? The Natural Philosopher <tnp@invalid.invalid> - 2013-05-24 15:00 +0100
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:20 -0700
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:35 -0400
Re: why php echo does not show up in HTML? The Natural Philosopher <tnp@invalid.invalid> - 2013-05-24 16:59 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:34 -0400
Re: why php echo does not show up in HTML? "Peter H. Coffin" <hellsop@ninehells.com> - 2013-05-24 10:51 -0500
Re: why php echo does not show up in HTML? Richard Yates <richard@yatesguitar.com> - 2013-05-26 07:02 -0700
Re: why php echo does not show up in HTML? "J.O. Aho" <user@example.net> - 2013-05-24 20:26 +0200
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 15:34 -0400
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:35 -0400
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:14 -0700
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:38 -0400
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:53 -0700
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 11:06 -0400
Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:18 +0000
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 12:04 -0400
Re: why php echo does not show up in HTML? gordonb.aykca@burditt.org (Gordon Burditt) - 2013-05-24 22:59 -0500
Re: why php echo does not show up in HTML? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-25 09:20 +0200
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-25 09:22 -0400
Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:49 +0000
Re: why php echo does not show up in HTML? Scott Johnson <noonehome@chalupasworld.com> - 2013-05-24 17:06 -0700
Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:12 +0000
Re: why php echo does not show up in HTML? Richard Yates <richard@yatesguitar.com> - 2013-05-26 07:13 -0700
Re: why php echo does not show up in HTML? yousafali3949@gmail.com - 2017-07-16 07:14 -0700
Re: why php echo does not show up in HTML? Mark Lloyd <not@mail.invalid> - 2017-07-16 09:55 -0500
Re: why php echo does not show up in HTML? V <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvva@hotmail.com> - 2023-07-11 22:22 -0700
csiph-web