Solved

Refreshing a page

Posted on 2000-02-22
8
213 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 8

Expert Comment

by:us111
Comment Utility
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
Comment Utility
<? // 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
Comment Utility
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
 
LVL 8

Expert Comment

by:us111
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Accepted Solution

by:
maxkir earned 50 total points
Comment Utility
<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
Comment Utility
Use dreamweaver 3, very useful with PHP, you can edit your page
without any problems.
0
 
LVL 5

Author Comment

by:j_powers
Comment Utility
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
Comment Utility
The simplist answers always work. I am so used to saying PHP3, I forget to switch back.

Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now