?
Solved

Refreshing a page

Posted on 2000-02-22
8
Medium Priority
?
279 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

777 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