By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

Simple question

P: n/a
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
Jul 16 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Rik
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('Location : 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
Jul 16 '06 #2

P: n/a

"Rik" <lu************@hotmail.comwrote in message
news:a4***************************@news1.tudelft.n l...
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('Location : 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


Jul 16 '06 #3

P: n/a
"Rik" <lu************@hotmail.comwrote in message
news:a4***************************@news1.tudelft.n l...
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
Jul 16 '06 #4

P: n/a
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" <lu************@hotmail.comwrote in message
news:a4***************************@news1.tudelft.n l...
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
Jul 16 '06 #5

P: n/a
Rik
Sheldon Glickler wrote:
"Rik" <lu************@hotmail.comwrote in message
news:a4***************************@news1.tudelft.n l...
>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:
http://www.mcanerin.com/EN/articles/...-scripting.asp

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

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

Grtz,
--
Rik Wasmus
Jul 16 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.