Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:36:30+00:00 2026-06-04T00:36:30+00:00

R: 1 <?php $uri = ‘http://’ . $_SERVER[‘HTTP_HOST’]; $path = ‘/dev/source/class.ControlEntry.php’; $string = $uri

  • 0

R:1

<?php
    $uri = 'http://' . $_SERVER['HTTP_HOST'];
    $path = '/dev/source/class.ControlEntry.php';
    $string = $uri . $path;
    header('Location: '. $string );

Am I actually hitting my server and then redirecting back to the client which then calls the new location. Is this 2 round trips to access my site located at the uri and path above?

Per php.net header() sends a raw http header.

Xampp uses code similar to this to specify the directory the source code is in.

However, I’m thinking about just using an include, as was determined best practice in this related SO post.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:36:31+00:00Added an answer on June 4, 2026 at 12:36 am

    Yes, sending a “Location” header causes the browser to make second request to that location.

    There are many ways to avoid this including use an include as you mentioned. However the advantage of the redirect is that the browser shows the desired URL in the address bar vs. hiding the fact that they browsed to the “wrong” place by sending them data anyway.

    The typical round trip time for a home internet connection is well below 1 second, so if you only do this once, users are unlikely to notice. That said, every millisecond counts when people have short attention spans and access to 20 millions videos of cats just a few clicks away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

shorten('http://www.google.com'); ?> WORKING!!! $currenturl = (!empty($_SERVER['HTTPS'])) ? https://.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : http://.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; include('bitly.php'); $bitly = new
I grab the URI string with php code. The URI could be: solution 1
Having an issue here where the $_SERVER['REQUEST_URI'] is spitting out: /dev/nava2/store/index.php?route=product/product&amp;product_id=48 the actual URL
I have a string in PHP that is a URI with all arguments: $string
here is the URI: example.com/index.php/products/shoes/sandals/123 and here is the corresponding controller: <?php class Products
I have the following IF statement: if (strpos($_SERVER['REQUEST_URI'], '/dev/mahjong/mahjong.php') === strlen($_SERVER['REQUEST_URI']) - strlen('/dev/mahjong/mahjong.php') )
How do I check if a URI exists with PHP? I guess it will
Is there a maximum length for the URI in the file_get_contents() function in PHP?
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
PHP/MySQLisolating database access in class - how to handle multiple row Selects Here’s a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.