Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Virtual Host.
php - how to create virtual host on XAMPP - Stack Overflow
Nancy
Copy link to clipboard
Copied
This thread seemed at little confusing as there were errors. I was hoping to find a straightforward solution where nothing was in doubt.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks, Rob. One other question: Is localhost.mydomain.edu the same as localhost/mydomain.edu ?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
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.)
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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) .
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I think you're right, I'm still confused as to why he chose localhost as the subdomain.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Searching is never difficult, it's trying out one erroneous solution after another that's difficult.