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 8961647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:56:33+00:00 2026-06-15T15:56:33+00:00

Possible Duplicate: HTTP_HOST vs. SERVER_NAME What is the difference between $_SERVER[‘HTTP_HOST’] and $_SERVER[‘SERVER_NAME’] ??

  • 0

Possible Duplicate:
HTTP_HOST vs. SERVER_NAME

What is the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME'] ??

  • 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-15T15:56:34+00:00Added an answer on June 15, 2026 at 3:56 pm

    $_SERVER['SERVER_NAME'] gives the value of the server name as defined in host configuration (i.e for Apache the Apache .conf file).

    $_SERVER['HTTP_HOST'] gives you the domain name through which the current request is being fulfilled and is more directly related to the request.

    HTTP_HOST is typically more useful in most applications in that it relates directly to the request, whereas SERVER_NAME could return whatever value is in the conf file and doesn’t tell you anything about the request at all.

    I will give you an example of how HTTP_HOST might differ from SERVER_NAME. Say you have an host defined in Apache with ServerName of example.com and an IP address of 1.2.3.4.

    Let’s look at two incoming request URLs and show the difference between these variables:

    http://www.example.com
    HTTP_HOST = www.example.com
    SERVER_NAME = example.com
    
    http://1.2.3.4
    HTTP_HOST = 1.2.3.4
    SERVER_NAME = example.com
    

    So again, HTTP_HOST is tied more to the request, whereas SERVER_NAME is determined by server configuration.

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

Sidebar

Related Questions

Possible Duplicate: difference between http.context.user and thread.currentprincipal and when to use them? What's the
Possible Duplicate: How to differentiate between http and cli requests? Which method to detect
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Java - Regex problem I have list of URLs of types: http://www.example.com/pk/etc
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How to do the vector of sets in C++? I want to
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: check whether internet connection is available with C# I just want to

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.