[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Refreshing a page

Posted on 2000-02-22
8
Medium Priority
?
288 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Technology Partners: 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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
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.
Suggested Courses

656 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