Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating a fake host name with XAMPP

Engaged ,
Mar 02, 2017 Mar 02, 2017

Does anyone know how to create a fake host name using XAMPP? Usually the site is defined as http://localhost/mydomain/  but I need to do something like this: localhost.mydomain.edu

I am trying to find the file to modify in my XAMPP set up.

3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2017 Mar 02, 2017

Virtual Host.

php - how to create virtual host on XAMPP - Stack Overflow

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

This thread seemed at little confusing as there were errors. I was hoping to find a straightforward solution where nothing was in doubt.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 02, 2017 Mar 02, 2017

I don't use XAMPP, but this should work:

Using Windows file manager, go to C: > Windows > System32 > drivers > etc

Open hosts and add an entry like 127.0.0.1  mydomainname

You might have to do this in safe mode

Then go to your apache directory > conf > extra > httpd-vhosts.conf and add an entry like

<VirtualHost *:80>
    DocumentRoot "D:/Apache24/htdocs/mydomainname"
    ServerName mydomainname
</VirtualHost>

Open httpd.conf in the conf directory and look for #LoadModule vhost_alias_module modules/mod_vhost_alias.so and remove the hash to activate it.

Next look for #Include conf/extra/httpd-vhosts.conf and remove the hash tag from it.

Then reboot your computer. Open a browser (not MS Edge) and type http://mydomainname

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

Thanks, Rob. One other question: Is localhost.mydomain.edu the same as localhost/mydomain.edu   ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 02, 2017 Mar 02, 2017

No, they are not the same.

If you are going to use localhost like this (localhost/mydomain) then you don't need to create a virtual host. Don't add a top level domain to the virtual host (com, edu, net)

If I have a website with the address mydomainname.com, then I create a virtual host with the name mydomainname. It makes it easy to keep track.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

I am only used to using localhost as localhost/mydomain. I am creating a virtual host in order to fake the domain name of the hosting educational institution. So I assume localhost.mydomain.edu refers to the fact that I've got to add a subdomain to  the fake domain.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 02, 2017 Mar 02, 2017

I am creating a virtual host in order to fake the domain name of the hosting educational institution

And the website address of the hosting institution starts with "localhost?" I find that hard to believe.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2017 Mar 02, 2017

Sounds like he's trying to use a local testing server to serve up an intranet site to me, and trying to make the address more "web like".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 02, 2017 Mar 02, 2017

We'll have to wait and see the response. The fact that he puts localhost in the same address as a TLD is what confuses me.

Paul, remember, DO NOT add a TLD to your virtual hosts. (TLD = edu, com, net, etc.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

Well, this is certainly confusing.

We're trying to use the university's CAS service to allow users to be logged in to the using their university login credentials. Instead of logging in to the site and using the Joomla (or in this case Community Builder) login. There is an extension for Joomla allowing external login capability.

So we're trying to get  localhost.mydomain.edu to point to 127.0.0.1 for developmental purposes.

In this example, the httpd-vhosts.config file uses www.mysite.com for the fake hostname.

php - Using Domain name instead of localhost in with https in xampp - Stack Overflow

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 02, 2017 Mar 02, 2017

So we're trying to get  localhost.mydomain.edu to point to 127.0.0.1 for developmental purposes.

Where is localhost.mydomain.edu? For virtualhost to work, it must be on the development computer.

any sysadmin at the university could resolve this for you or tell you if you are going down the wrong road.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

The fake hostname is on my development computer. He actually said XXX.localhost.universitydomainname.edu/ to be clear. I assume the three X's simply refer to what ordinarily precedes localhost (as in http://localhost) . 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

The CAS service will only accept connections with a mydomain.edu  hostname where mydomain.edu  is the name of the university. So I need to create a fake hostname on localhost where I assume I can create a subdomain of mydomain.edu , then install the Joomla external login extension  and test it locally to see if it works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

https://forums.adobe.com/people/Rob+Hecker2  wrote

We'll have to wait and see the response. The fact that he puts localhost in the same address as a TLD is what confuses me.

Paul, remember, DO NOT add a TLD to your virtual hosts. (TLD = edu, com, net, etc.)

By using all caps are you indicating that this is a security risk to my computer?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 02, 2017 Mar 02, 2017

By using all caps are you indicating that this is a security risk to my computer?

Not a security risk necessarily. What if you create a virtual host called google.com? How will the browser know when you want the google.com you created and when you want the external one? If you never create a virtualhost with a TLD, you never have to worry about this issue.

The fake hostname. . .

Don't think of it as a fake hostname. It isn't. It's simply a domain localized to your computer.

I assume the three X's simply refer to what ordinarily precedes localhost

Nothing ordinarily precedes localhost. I have no idea why someone would create a virtualhost like the one you have shown.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 04, 2017 Mar 04, 2017

In order to test the CAS login from the actual university website I have to create a fake hostname on my local server that is identical to the university domain name, otherwise it will not work. And since the website will be hosted in a subdomain of the university domain name, I can replicate this setup locally using localhost.universitydomainname.edu.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 04, 2017 Mar 04, 2017

OK. That helps explain it.

And you are going to use "localhost" as the subdomain of universitydomainname.edu? If that works, fine, but if it doesn't work, it may be because -  since localhost is the root of your local web, it can't be used as a subdomain as well.

In the following address, localhost is the subdomain and universitydomainname is the root domain and TLD is the top level domain.

localhost.universitydomainname.edu.

I would not use localhost in the name. Instead something like:

othername.universitydomainname.edu.

I often create subdomains for new websites. In the following, the numbers are the subdomains. mydomain is the root domain, and COM is the TLD

11.mywebsite.com

14.mywebsite.com

32.mywebsite.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 04, 2017 Mar 04, 2017
LATEST

I think you're right, I'm still confused as to why he chose localhost as the subdomain.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

That's right. For privacy purposes I have to override the Joomla (Community Builder) login with an extension which allows external login using their CAS service.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

paulk7737514  wrote

This thread seemed at little confusing as there were errors. I was hoping to find a straightforward solution where nothing was in doubt.

You know what to search for now - Virtual Host - so finding a straightforward solution should not be difficult if you search Google for relevant terms, right?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2017 Mar 02, 2017

Searching is never difficult, it's trying out one erroneous solution after another that's difficult.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines