Solved

Refreshing a page

Posted on 2000-02-22
8
240 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
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php construct 5 27
PHP-Client-Registration-Login article and  saving last last login 6 29
PHP AJAX Wordpress 9 21
website maintenance mode 1 17
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

773 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