Solved

Refreshing a page

Posted on 2000-02-22
8
260 Views
Last Modified: 2012-05-04
My dilemma: I have a page that can be accessed by 2 URLs. If they use URLB, then some scripts don't work properly.

To fix this, I thought I would put the following script at the top. It would notice the page URL, and refresh it to URLA. Problem is, that script does not work.

If anyone can help, I would appreciate it:

<script language = "php3">
$urla = getenv("SERVER_NAME");
if ($urla == "www.urlb.com")
{
Header('Location: http://www.urla.com/folder/page.php3');
exit;
}
</script>

COMMENTS ONLY. I will award points at the end.
0
Comment
Question by:j_powers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 8

Expert Comment

by:us111
ID: 2549535
I'm sure, you should replace
<script language = "php3">  by <?

and

</script> by ?>


<?
                      $urla = getenv("SERVER_NAME");
                      if ($urla == "www.urlb.com")
                      {
                      Header('Location: http://www.urla.com/folder/page.php3');
                      exit;
                      }
 ?>
will work fine :))

0
 
LVL 2

Expert Comment

by:maxkir
ID: 2550027
<? // This is _first_ line on the page

 if ( $SERVER_NAME == "www.urlb.com")
 {
    Header('Location: http://www.urla.com/folder/page.php3');
    exit;
 }
?>
0
 
LVL 5

Author Comment

by:j_powers
ID: 2550356
Nope. Not only does it not matter whether it's <script language = php3> or <?, but if I use the '<?' tag, Front Page will move the code after the <body> tag.

I have a test server that works the code fine. My provider on this page is using the latest and greatest version.

Any other thoughts?
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 8

Expert Comment

by:us111
ID: 2550528
check before your script if you have HTML tag.
The Header function must be called before any actual output is sent either by normal HTML tags or from PHP.

It maybe your problem
0
 
LVL 2

Accepted Solution

by:
maxkir earned 50 total points
ID: 2550680
<script language="php">
                      // This is _first_ line on the page

                       if ( $SERVER_NAME == "www.urlb.com")
                       {
                          Header('Location: http://www.urla.com/folder/page.php3');
                          exit;
                       }
</script>

Note language="php" , not language="php3"
0
 
LVL 8

Expert Comment

by:us111
ID: 2550774
Use dreamweaver 3, very useful with PHP, you can edit your page
without any problems.
0
 
LVL 5

Author Comment

by:j_powers
ID: 2552289
I'd use Dreamweaver3, but my host accepts FP2000.

There is no <html> before that.

Max - I cannot remember if I put php or php3. I will check tonight, and let you know.
0
 
LVL 5

Author Comment

by:j_powers
ID: 2552783
The simplist answers always work. I am so used to saying PHP3, I forget to switch back.

Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question