Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9561 > unrolled thread
| Started by | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| First post | 2013-05-24 01:08 -0700 |
| Last post | 2023-07-11 22:22 -0700 |
| Articles | 20 on this page of 44 — 16 participants |
Back to article view | Back to comp.lang.php
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
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 10:35 -0400 |
| Message-ID | <knntj8$j8k$2@dont-email.me> |
| In reply to | #9586 |
On 5/24/2013 10:20 AM, steve nospam wrote: > On May 24, 9:00 am, The Natural Philosopher <t...@invalid.invalid> > wrote: > >> >> |echo (file_get_contents( "filename.htm" ));| >> >> ? >> > > huh? what is this? > The usual tripe TNP espouses. He's not very smart and his comprehension is lacking. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-05-24 16:59 +0100 |
| Message-ID | <kno2oq$18f$1@news.albasani.net> |
| In reply to | #9586 |
On 24/05/13 15:20, steve nospam wrote: > On May 24, 9:00 am, The Natural Philosopher <t...@invalid.invalid> > wrote: > >> |echo (file_get_contents( "filename.htm" ));| >> >> ? >> > huh? what is this? Its an Answer -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 10:34 -0400 |
| Message-ID | <knnth3$j8k$1@dont-email.me> |
| In reply to | #9583 |
On 5/24/2013 10:00 AM, The Natural Philosopher wrote: > On 24/05/13 14:20, 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. >> guys, the above fix did not work on the server. Must be something with >> the php used there. It worked on my local apache server. So, I still >> looking for a solution. My question is this: >> >> If I change my index.htm to index.php, is there a way to make an alias >> or something so that not all my links are broken? so that a link to >> index.htm will use index.php? >> >> Ok, let me go back one step: This is all crazy, because all what I >> wanted to do is simple: use php to include some common html code into >> all my html web pages. So how is one supposed to do this if one can't >> use php inside html? > > |echo (file_get_contents( "filename.htm" ));| > > ? ROFLMAO! Typical of your level of comprehension, TNP. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Date | 2013-05-24 10:51 -0500 |
| Message-ID | <slrnkpv337.msg.hellsop@nibelheim.ninehells.com> |
| In reply to | #9575 |
On Fri, 24 May 2013 06:20:03 -0700 (PDT), 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. > > guys, the above fix did not work on the server. Must be something with > the php used there. It worked on my local apache server. The server configuration may be forbidding FileInfo overrides from .htaccess. In newer Apache versions, allowing this by default is no longer the case, either. > So, I still > looking for a solution. My question is this: > > If I change my index.htm to index.php, is there a way to make an alias > or something so that not all my links are broken? so that a link to > index.htm will use index.php? No. What handler the Apache server uses for type depends on the name. You cannot use a different thing in the name than what the server is looking for and get it to work. -- "It's 106 light-years to Chicago, we've got a full chamber of anti- matter, a half a pack of cigarettes, it's dark, and we're wearing visors." "Engage."
[toc] | [prev] | [next] | [standalone]
| From | Richard Yates <richard@yatesguitar.com> |
|---|---|
| Date | 2013-05-26 07:02 -0700 |
| Message-ID | <a154q8l0j462g0oc70222b2dturmai35an@4ax.com> |
| In reply to | #9575 |
On Fri, 24 May 2013 06:20:03 -0700 (PDT), steve nospam <steve.nospamm@gmail.com> wrote: >I want to use php call to include common HTML code into an html page, >but can't use php from HTML? what is the deal here? So, how do people >do this thing then? I sympathize. I had a similar situation with a site with some html and some php files. As i refined it and added features i found that pages I thought would never need dynamic content did. There are awkward workarounds, but best might be to just switch all html files to php. Use a global search-and-replace to change all instances of '.html' to '.php' and your internal links will all work. If you need to make a few html redirect pages for folks that have bookmarked the html links, all you need to redirect index.html is: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Home</title> <meta http-equiv="REFRESH" content="0;url=http://www.yoursite.org/index.php"></HEAD> <BODY> </BODY> </HTML>
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-05-24 20:26 +0200 |
| Message-ID | <b09pm1FmrntU1@mid.individual.net> |
| In reply to | #9565 |
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 --- -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 15:34 -0400 |
| Message-ID | <knof3t$um9$1@dont-email.me> |
| In reply to | #9608 |
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 ==================
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 09:35 -0400 |
| Message-ID | <knnq3q$va9$1@dont-email.me> |
| In reply to | #9561 |
On 5/24/2013 4:08 AM, steve nospam wrote: > newbie. > > could someone explain why this does not work? > > <!DOCTYPE html> > <html> > <body> > <p>before > > <?php echo "do you see this?"; ?> > > <p>after > </body> > </html> > > I spend 2 hrs and tried everything and read many things, but message > in echo does not show on the browser. I upload this to the web server. > I also have local web server running. Both support php. I see no error > in the access log file and no error in the php error log file. So the > page is bring loaded OK by the web server. But I do not see the echo. > What Ami doing wrong? > > cheers, > steve > Look at the source in your browser. You will see the message, including the <?php echo... The web server will not (by default) pass pages to the PHP interpreter unless they have a .php extension. You can include PHP code in html code, but need to parse them as PHP. If you're using Apache, you could change the Apache configuration to pass all pages to the PHP interpreter, but this can cause extra load on the server due to unnecessarily parsing non-PHP pages as PHP code. It is also not portable and will not run on hosts where this type of configuration is not allowed. Your best bet is to simply change the files you need to include PHP code in to a .php extension and fix the links on your site. For external links, configure your web server to do a permanent redirect from the old page to the new (see your web server configuration for more information on how to do this). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 07:14 -0700 |
| Message-ID | <f8f531ee-6d30-49e5-a981-b7725a253276@o2g2000yqb.googlegroups.com> |
| In reply to | #9579 |
> Your best bet is to simply change the files you need to include PHP code > in to a .php extension and fix the links on your site. For external > links, configure your web server to do a permanent redirect from the old > page to the new (see your web server configuration for more information > on how to do this). > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > JDS Computer Training Corp. > jstuck...@attglobal.net > ================== I can't do this. I need to include common html code to every html file I have. This means I have to change the extension of 1000's of html files to .php and therefore any outside links and any google searches will be broken now. May be I should have done this at first, but too late now to change index.htm to index.php.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 10:38 -0400 |
| Message-ID | <knntp8$l2n$1@dont-email.me> |
| In reply to | #9584 |
On 5/24/2013 10:14 AM, steve nospam wrote: > >> Your best bet is to simply change the files you need to include PHP code >> in to a .php extension and fix the links on your site. For external >> links, configure your web server to do a permanent redirect from the old >> page to the new (see your web server configuration for more information >> on how to do this). >> > > I can't do this. I need to include common html code to every html file > I have. This means I have to change the extension of 1000's of html > files to .php and therefore any outside links and any google searches > will be broken now. > You only need to change the file names for those files which include php code. Files which do not contain HTML code need no changes. But yes, if you're going to add php code to thousands of html files, then you need to change the extensions of thousands of files. And no, the external links are NOT broken if you do a permanent redirect as I suggested before. That's what it is there for. > May be I should have done this at first, but too late now to change > index.htm to index.php. > No, it is not too late if you understand how to properly configure your web server. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 07:53 -0700 |
| Message-ID | <ad1267f0-4f45-4044-afc5-699315dd59e6@g3g2000yqg.googlegroups.com> |
| In reply to | #9590 |
On May 24, 9:38 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > > No, it is not too late if you understand how to properly configure your > web server. > I can;t configure or change the web server. As I said, I use a web hosting company. I am on a shared sever used by 100's others on the main server. I can't call my hosting company talk to tech support and tell to please edit the server config files for me and see if this will work.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 11:06 -0400 |
| Message-ID | <knnvde$ugk$1@dont-email.me> |
| In reply to | #9591 |
On 5/24/2013 10:53 AM, steve nospam wrote: > On May 24, 9:38 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > >> >> No, it is not too late if you understand how to properly configure your >> web server. >> > > I can;t configure or change the web server. As I said, I use a web > hosting > company. I am on a shared sever used by 100's others on the main > server. > You can still do redirects. That is something EVERY web host supports. > I can't call my hosting company talk to tech support and tell to > please > edit the server config files for me and see if this will work. > If you're using Apache, it can be done in the .htaccess file. Other web servers have similar ways. Learn to use the tools you have before claiming something "cannot be done". Do you want to fix your problem or just cry about it? So far, all you've done is the latter. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2013-05-24 15:18 +0000 |
| Message-ID | <XnsA1CA73AA68EEBdougmilmaccom@78.46.70.116> |
| In reply to | #9591 |
steve nospam <steve.nospamm@gmail.com> wrote in news:ad1267f0-4f45-4044-afc5-699315dd59e6@g3g2000yqg.googlegroups.c om: > On May 24, 9:38 am, Jerry Stuckle <jstuck...@attglobal.net> > wrote: > >> >> No, it is not too late if you understand how to properly >> configure your web server. >> > > I can;t configure or change the web server. As I said, I use a > web hosting company. I am on a shared sever used by 100's > others on the main server. That doesn't mean you can't change the configuration for your portion of it. > I can't call my hosting company talk to tech support and tell to > please edit the server config files for me and see if this will work. No, that's true, you can't. Fortunately, you don't need to. You should be able to do everything you need in the .htaccess file in your web root directory. You possibly will need to add a php.ini file as well -- see below: <contents of php.ini> auto_prepend_file = "<file to be prepended to everything generated by php>" include_path = "<path(s) to various directories where include files are located>" expose_php = off display_errors = off
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 12:04 -0400 |
| Message-ID | <kno2q0$hj5$1@dont-email.me> |
| In reply to | #9597 |
On 5/24/2013 11:18 AM, Doug Miller wrote: > steve nospam <steve.nospamm@gmail.com> wrote in > news:ad1267f0-4f45-4044-afc5-699315dd59e6@g3g2000yqg.googlegroups.c > om: > >> On May 24, 9:38 am, Jerry Stuckle <jstuck...@attglobal.net> >> wrote: >> >>> >>> No, it is not too late if you understand how to properly >>> configure your web server. >>> >> >> I can;t configure or change the web server. As I said, I use a >> web hosting company. I am on a shared sever used by 100's >> others on the main server. > > That doesn't mean you can't change the configuration for your portion of it. > >> I can't call my hosting company talk to tech support and tell to >> please edit the server config files for me and see if this will work. > > No, that's true, you can't. Fortunately, you don't need to. You should be able to do everything > you need in the .htaccess file in your web root directory. You possibly will need to add a > php.ini file as well -- see below: > > <contents of php.ini> > auto_prepend_file = "<file to be prepended to everything generated by php>" > include_path = "<path(s) to various directories where include files are located>" > expose_php = off > display_errors = off > > > > None of which have anything to do with his problem... -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | gordonb.aykca@burditt.org (Gordon Burditt) |
|---|---|
| Date | 2013-05-24 22:59 -0500 |
| Message-ID | <p-qdnWNm6ZaLqj3MnZ2dnUVZ_vednZ2d@posted.internetamerica> |
| In reply to | #9597 |
> That doesn't mean you can't change the configuration for your portion of it.
>
>> I can't call my hosting company talk to tech support and tell to
>> please edit the server config files for me and see if this will work.
>
> No, that's true, you can't. Fortunately, you don't need to. You should be able to do everything
> you need in the .htaccess file in your web root directory. You possibly will need to add a
This presumes that the hosting company has not put the directive
"AllowOverride None" in their configuration for your site. (For
Apache 2.3.9 and later, this is the default). It speeds up serving
web pages slightly by never looking for .htaccess files at all.
Therefore, you can't do redirects in .htaccess . If you discover
that your hosting company does this and they won't budge, find
another hosting company.
I recall trying to help some friends dealing with a hosting company
paranoid about security, at least for cheap/free accounts. One
official way to close your account was to upload a .htaccess file
(containing anything at all, or nothing at all). Your account would
be gone within an hour. So would all the other accounts using the
same payment account. And no, you couldn't get it back, except
perhaps by using a fake name and different domain name and payment
account. This was long ago and they offered essentially NO active
content or PHP except a hit counter CGI they provided.
You *CAN* do a redirect with pure HTML (done in the user's browser):
<HEAD>
<META HTTP-EQUIV="refresh" CONTENT="1;URL=http://mysite.com/path/foobar.php">
</HEAD>
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-05-25 09:20 +0200 |
| Message-ID | <2054419.zLiHAdIVJA@PointedEars.de> |
| In reply to | #9636 |
Gordon Burditt wrote: > […] > You *CAN* do a redirect with pure HTML (done in the user's browser): > > <HEAD> > <META HTTP-EQUIV="refresh" > CONTENT="1;URL=http://mysite.com/path/foobar.php"> > </HEAD> But this does not always work, and it is *strongly* recommended *against* anyway: <http://www.w3.org/QA/Tips/reback> PointedEars -- When all you know is jQuery, every problem looks $(olvable).
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-25 09:22 -0400 |
| Message-ID | <knqdmh$aig$1@dont-email.me> |
| In reply to | #9636 |
On 5/24/2013 11:59 PM, Gordon Burditt wrote: >> That doesn't mean you can't change the configuration for your portion of it. >> >>> I can't call my hosting company talk to tech support and tell to >>> please edit the server config files for me and see if this will work. >> >> No, that's true, you can't. Fortunately, you don't need to. You should be able to do everything >> you need in the .htaccess file in your web root directory. You possibly will need to add a > > This presumes that the hosting company has not put the directive > "AllowOverride None" in their configuration for your site. (For > Apache 2.3.9 and later, this is the default). It speeds up serving > web pages slightly by never looking for .htaccess files at all. > Therefore, you can't do redirects in .htaccess . If you discover > that your hosting company does this and they won't budge, find > another hosting company. > > I recall trying to help some friends dealing with a hosting company > paranoid about security, at least for cheap/free accounts. One > official way to close your account was to upload a .htaccess file > (containing anything at all, or nothing at all). Your account would > be gone within an hour. So would all the other accounts using the > same payment account. And no, you couldn't get it back, except > perhaps by using a fake name and different domain name and payment > account. This was long ago and they offered essentially NO active > content or PHP except a hit counter CGI they provided. > > You *CAN* do a redirect with pure HTML (done in the user's browser): > > <HEAD> > <META HTTP-EQUIV="refresh" CONTENT="1;URL=http://mysite.com/path/foobar.php"> > </HEAD> > Yes, but any hosting company which does that won't be in business for long. For instance, most CMS's depend on being able to use mod_rewrite. Doing it in HTML requires maintaining a whole set of additional files. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-24 22:49 +0000 |
| Message-ID | <knoqqk$qpi$6@dont-email.me> |
| In reply to | #9591 |
On Fri, 24 May 2013 07:53:52 -0700, steve nospam wrote: > I can;t configure or change the web server. As I said, I use a web > hosting company. I am on a shared sever used by 100's others on the main > server. > > I can't call my hosting company talk to tech support and tell to please > edit the server config files for me and see if this will work. OK, so here's a list of other things you can not do: - You can not change the server so that it processes htm files as php files. Here's a list of things you can do: + You can download all the files from the server webroot to your local machine to bulk edit them + You can use tools such as sed to change every local url from .htm to .php + You can rename all the .htm files to .php files + You can automate the redirection of requests to *.htm to serve up the *.php files instead + You can upload all the fixed files to the server webroot External and existing search engine links will still work, because requesting the old .htm file will get the new .php file automatically. This is not a technically difficult fix, although you may need to spend a bit of time on getting to grips with the changes that need to be made and the tools that can make them if you have never had to do anything like this before. However, for any reasonably experienced website maintainer, this is probably the sort of issue that gets thrown at them occasionally (in some cases very regularly) and it's good practice to get used to using the sort of tools that can be used to sole such issues. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Scott Johnson <noonehome@chalupasworld.com> |
|---|---|
| Date | 2013-05-24 17:06 -0700 |
| Message-ID | <knov3j$eum$3@dont-email.me> |
| In reply to | #9623 |
On 5/24/2013 3:49 PM, Denis McMahon wrote: > On Fri, 24 May 2013 07:53:52 -0700, steve nospam wrote: > >> I can;t configure or change the web server. As I said, I use a web >> hosting company. I am on a shared sever used by 100's others on the main >> server. >> >> I can't call my hosting company talk to tech support and tell to please >> edit the server config files for me and see if this will work. > > OK, so here's a list of other things you can not do: > > - You can not change the server so that it processes htm files as php > files. > > Here's a list of things you can do: > > + You can download all the files from the server webroot to your local > machine to bulk edit them > + You can use tools such as sed to change every local url from .htm > to .php > + You can rename all the .htm files to .php files > + You can automate the redirection of requests to *.htm to serve up the > *.php files instead > + You can upload all the fixed files to the server webroot > > External and existing search engine links will still work, because > requesting the old .htm file will get the new .php file automatically. > > This is not a technically difficult fix, although you may need to spend a > bit of time on getting to grips with the changes that need to be made and > the tools that can make them if you have never had to do anything like > this before. However, for any reasonably experienced website maintainer, > this is probably the sort of issue that gets thrown at them occasionally > (in some cases very regularly) and it's good practice to get used to > using the sort of tools that can be used to sole such issues. > +1
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2013-05-24 15:12 +0000 |
| Message-ID | <XnsA1CA7296BAC68dougmilmaccom@78.46.70.116> |
| In reply to | #9584 |
steve nospam <steve.nospamm@gmail.com> wrote in news:f8f531ee-6d30-49e5-a981- b7725a253276@o2g2000yqb.googlegroups.com: > >> Your best bet is to simply change the files you need to include PHP code >> in to a .php extension and fix the links on your site. For external >> links, configure your web server to do a permanent redirect from the old >> page to the new (see your web server configuration for more information >> on how to do this). > > I can't do this. Yes, you can. > I need to include common html code to every html file > I have. I understand that. >This means I have to change the extension of 1000's of html > files to .php and therefore any outside links and any google searches > will be broken now. No, it does *not* mean that. As Jerry said -- configure your web server to do a permanent redirection from the old page to the new. See http://www.somacon.com/p145.php for ideas. The section most likely to be useful to you is about 1/3 of the way down the page, "Redirection with mod_rewrite". > May be I should have done this at first, but too late now to change > index.htm to index.php. So don't change them. Redirect them.
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.lang.php
csiph-web