[solved]How to run your site without the "localhost"

Problems with the Windows version of XAMPP, questions, comments, and anything related.

[solved]How to run your site without the "localhost"

Postby eesa123 » 01. May 2012 23:45

Hi,
i am trying to run my site without the http://localhost/ before the site name example this is how it is "http://localhost/mywebsite.com" the way i want it to be is like this "http://mywebsite.com" i am striving to get it to work like this ,,,
any one has a pen to put in the plate ?
looking forward for an answer
will be greatly appreciated...
eesa123
 
Posts: 2
Joined: 01. May 2012 23:40
Operating System: windows 7 64 Bit

Re: How to run your site without the "localhost" or ip addre

Postby Altrea » 02. May 2012 05:14

Hi eesa123,

step by step:
  • be sure, that you don't hide hidden files
  • open your Windows Editor with higher administrative permissions (Rightclick context menu -> run as administrator)
    This step is very important. Otherwise you will not be able to save the next file due to UserAccountControl deny
  • Within your editor open the file C:\Windows\system32\drivers\etc\HOSTS
  • at the bottom of the file create a new entry
    Code: Select all
    127.0.0.1    mywebsite.com
  • save the file
  • open your C:\xampp\apache\conf\extra\httpd-vhosts.conf
  • remove all # in front of the NameVirtualHost *:80 line
  • at the bottom of the file create two new blocks:
    Code: Select all
    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs"
        ServerName localhost
    </VirtualHost>

    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs/mywebsite.com"
        ServerName mywebsite.com
    </VirtualHost>
  • save the file
  • restart your Apache (or even better restart your computer)

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: How to run your site without the "localhost" or ip addre

Postby eesa123 » 02. May 2012 08:13

thanks a lot done!
eesa123
 
Posts: 2
Joined: 01. May 2012 23:40
Operating System: windows 7 64 Bit


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 141 guests