473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pseudo domain name on localhost

PRWang
1
I'm new to apache server so I'm having some challenges figuring some things out. Maybe what I want to do is not possible, but figured I would ask anyway.

I installed xampp on my HP Pavillion running Vista Ultimate (ugh!) on an external 160G usb hard drive (WD Passport). So far everything seems to be working except for FileZilla, but that is for a different forum.

I'm using Apache as a testbed before I ftp my sites to the web. I have them setup in different subdirectories indicating the web host and domain name. So, the file I'm working on now is in /htdocs/HostICan/yourturn. I can access the site by going to http://localhost/HostICan/yourturn, but is there a way I can shorten this address to something like http://yourturn.local?

I've played around with the hosts and the apache configuration files (VirtualHost) but so far am drawing a blank. Any help or ideas appreciated.

Thanks
Jan 6 '08 #1
5 4951
Markus
6,050 Expert 4TB
I just wrote a whole bunch here and, somehow, I managed to lose everything. Gah!.

Anyway, open your hosts file, on Vista this is usually located at C:/windows/System32/drivers/etc. Add the following line to it:

Expand|Select|Wrap|Line Numbers
  1. 127.0.0.1 yourturn.com
  2.  
You may see other lines in this file such as 127.0.0.1 localhost.

Save this file and close it.

Now, in the latest releases of XAMPP, they have a special file for virtual hosts - I cannot confirm this for earlier releases. This file can be located at <xampp dir>/apache/conf/etc/httpd-vhosts.conf. Open this file and add the following to it:

Expand|Select|Wrap|Line Numbers
  1. NameVirtualHost *:80
  2.  
  3. <VirtualHost *:80>
  4.  ServerName localhost
  5.  # Point to your root folder for localhost
  6.  DocumentRoot "C:\xampp\htdocs"
  7.  DirectoryIndex index.php index.html index.html index.htm index.shtml
  8. </VirtualHost>
  9.  
  10. <VirtualHost *:80>
  11.  ServerName yourturn.com
  12.  # Point to your root folder for yourturn.com
  13.  DocumentRoot "C:\xampp\htdocs\yourturn.com\htdocs"
  14.  DirectoryIndex index.php index.html index.html index.htm index.shtml
  15. </VirtualHost>
Restart apache, and navigate to http://yourturn.com. You should be greeted with the directory you specified in the virtual host.

Hope this helps,

Markus.
Jun 4 '09 #2
Atli
5,058 Expert 4TB
That's interesting.
I've always wondered how I could do that, but never really figured it out.

I wonder how I could do that same with a networked computer.
Like say, if I had an Apache server set up on a computer at IP 192.168.1.5, would editing my PC's hosts file be enough, or would I have to change something on the server to.

... damn. Now I won't be able to stop until I figure out a way to do that :P

Edit:
Yea. Turns out I just had to edit the hosts file on my PC. (W7)
Awesome... no more having to type IP addresses everywhere :)
Jun 5 '09 #3
Markus
6,050 Expert 4TB
@Atli
Cool as hell, right? :P
Jun 6 '09 #4
Atli
5,058 Expert 4TB
@Markus
Yea :D

Or wait... isn't hell supposed to be hot? :P
Jun 6 '09 #5
Markus
6,050 Expert 4TB
@Atli
Yeah but .. only the coolest people live in hell 8)
Jun 7 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: idog | last post by:
i noticed weird cookie problems when clients sometimes visit my site with the www. prefix and sometimes without the prefix. I decided to start setting the .domain property, but that doesnt work...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
4
by: UJ | last post by:
I have a need to know what the domain name is when I'm running a site. Essentially the problem I have is that I let the user build a web page and then I display it using a IFRAME. But the IFRAME...
4
by: Bruno | last post by:
Hello friends I need to create a simple application that returns the domain name where the user name logs in. For example, if I acccess in a computer with the domain user Contoso\bruno, my...
2
by: johkar | last post by:
I am getting an Access denied error when I write to a new window. The situation and code are outlined below. I am setting the domain in the main window. The problem is that the window I am...
6
by: MLH | last post by:
I'm tired of reading the fine print! Too many registrars out there. So I'm asking this group for a little help. I'm looking for a Registrar who will do an honest day's work for a fair price. I'm...
2
by: kelly.pearson | last post by:
Is this a bug? I am trying to write a cookie that can be accessed by various .Net applications on our domain. However, whenever I add the domain property to the cookie, no errors get thrown but...
6
by: Guy Macon | last post by:
While I agree with the sentiment, the oringinal title on this thread ("OT: Specially for , why you should always use example.com for obfuscating domains") is wrong. There are other reserved domain...
1
by: drdaveg | last post by:
I've been trying to get PHP 4 or 5 to work with my server. Both execute scripts when I call them as localhost, ie http://localhost:90/index.php but when I use the domain name ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.