Simple question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sheldon Glickler

    #1

    Simple question

    Here is the problem I have. I have added a management interface in php for
    a website that was all html and flash. Whereas before items were
    hard-coded, now they are pulled up from a database. I can change the links
    from html to php almost everywhere. One of them is located within a flash
    file, however. The source for it was lost because of a computer crash (yes,
    she didn't back it up -- arghh).

    So, here is what I want to do but don't know how. I want to replace the
    existing referenced html page with code that will redirect the user (without
    notification) to the new php page. I tried a test called test1.html that
    simply had a header statement within <?php ?to go to another page, but
    that didn't work.

    How do I code the html page to automatically go to another page?

    Shelly


  • Rik

    #2
    Re: Simple question

    Sheldon Glickler wrote:
    Here is the problem I have. I have added a management interface in
    php for a website that was all html and flash. Whereas before items
    were hard-coded, now they are pulled up from a database. I can
    change the links from html to php almost everywhere. One of them is
    located within a flash file, however. The source for it was lost
    because of a computer crash (yes, she didn't back it up -- arghh).
    I keep my hands of Flash, but maybe some people could help you retrieve it,
    so it can be altered?
    So, here is what I want to do but don't know how. I want to replace
    the existing referenced html page with code that will redirect the
    user (without notification) to the new php page. I tried a test
    called test1.html that simply had a header statement within <?php ?>
    to go to another page, but that didn't work.
    Why not?
    This should work, if the user allows redirects (and almost all users do):
    <?php header('Locatio n : http://www.example.com '; exit; ?>

    Keep in mind you shouldn't have any output before the header statement.
    How do I code the html page to automatically go to another page?
    It's possible in HTML, see
    http://webdesign.about.com/od/metata.../aa080300a.htm. It's Bad
    Practice though...

    If you can't do it in PHP for some reason, you could also do it in Apache
    using mod_rewrite.

    On a side note, the HTTP header 301 (permanently moved), was invented for
    this kind of stuff.

    Grtz,
    --
    Rik Wasmus


    Comment

    • Sheldon Glickler

      #3
      Re: Simple question


      "Rik" <luiheidsgoeroe @hotmail.comwro te in message
      news:a4607$44ba a69f$8259c69c$3 1682@news1.tude lft.nl...
      Sheldon Glickler wrote:
      >Here is the problem I have. I have added a management interface in
      >php for a website that was all html and flash. Whereas before items
      >were hard-coded, now they are pulled up from a database. I can
      >change the links from html to php almost everywhere. One of them is
      >located within a flash file, however. The source for it was lost
      >because of a computer crash (yes, she didn't back it up -- arghh).
      >
      I keep my hands of Flash, but maybe some people could help you retrieve
      it,
      so it can be altered?
      She bought something that can retrieve to code from the .swf, but is having
      problems.
      >
      >So, here is what I want to do but don't know how. I want to replace
      >the existing referenced html page with code that will redirect the
      >user (without notification) to the new php page. I tried a test
      >called test1.html that simply had a header statement within <?php ?>
      >to go to another page, but that didn't work.
      >
      Why not?
      This should work, if the user allows redirects (and almost all users do):
      <?php header('Locatio n : http://www.example.com '; exit; ?>
      This is exactly what I did, but calling it test1.htnl simply did not do
      anything. Remember that the intention is to replace a page that is
      currently pointed to as something.html with this redirecting file which will
      be called something.php and will be the modified original something.html so
      that it includes the new php stuff. Apparantly for the header statement to
      work it has to be in a .php file. Inside a .html file simply did not work.
      >
      Keep in mind you shouldn't have any output before the header statement.
      >
      >How do I code the html page to automatically go to another page?
      >
      It's possible in HTML, see
      http://webdesign.about.com/od/metata.../aa080300a.htm. It's Bad
      Practice though...
      >
      If you can't do it in PHP for some reason, you could also do it in Apache
      using mod_rewrite.
      >
      On a side note, the HTTP header 301 (permanently moved), was invented for
      this kind of stuff.
      >
      Grtz,
      --
      Rik Wasmus
      >
      >

      Comment

      • Sheldon Glickler

        #4
        Re: Simple question

        "Rik" <luiheidsgoeroe @hotmail.comwro te in message
        news:a4607$44ba a69f$8259c69c$3 1682@news1.tude lft.nl...
        It's possible in HTML, see
        http://webdesign.about.com/od/metata.../aa080300a.htm. It's Bad
        Practice though...
        This worked perfectly. Thanks. BTW, why is it bad practice?

        Shelly


        Comment

        • ybakos

          #5
          Re: Simple question

          Shelly, for your use this will be just fine. A better approach would be
          to configure your web server to 'forward' requests for problem.html to
          whatyouwant.php .

          In apache, you can specify a directive in .htaccess that will send the
          browser a '301' moved status code with the new url.

          Cheers,
          Yong


          Sheldon Glickler wrote:
          "Rik" <luiheidsgoeroe @hotmail.comwro te in message
          news:a4607$44ba a69f$8259c69c$3 1682@news1.tude lft.nl...
          It's possible in HTML, see
          http://webdesign.about.com/od/metata.../aa080300a.htm. It's Bad
          Practice though...
          >
          This worked perfectly. Thanks. BTW, why is it bad practice?
          >
          Shelly

          Comment

          • Rik

            #6
            Re: Simple question

            Sheldon Glickler wrote:
            "Rik" <luiheidsgoeroe @hotmail.comwro te in message
            news:a4607$44ba a69f$8259c69c$3 1682@news1.tude lft.nl...
            >It's possible in HTML, see
            >http://webdesign.about.com/od/metata.../aa080300a.htm. It's
            >Bad Practice though...
            >
            This worked perfectly. Thanks. BTW, why is it bad practice?

            Google it.
            Some reading material:


            If you have apache, I'd seriously suggest mod_rewrite, and creating a
            ..htacess file:

            ----.htaccess---------
            RewriteEngine On
            RewriteRule ^something\.htm l$ something.php [R=301]
            ----------------------

            Grtz,
            --
            Rik Wasmus


            Comment

            Working...