Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WAMP - Remove localhost from project URL

The URLs of my projects in WAMP are not resolving as I'd expect. For example, I'd expect the project in the folder c:\wamp\www\project1 to have the URL http://project1/, but it actually has the URL http://localhost/project1/.

This can cause problems when accessing server variables. How do I fix this?

like image 935
Rafael de Castro Avatar asked May 08 '14 20:05

Rafael de Castro


1 Answers

Okay, I had this problem. So, I troubleshooted the problem and traced it to an actual solution, NOT A HACK.

The SOLUTION :

  1. Right-Click WAMP-server icon
  2. Select WAMP Settings,
  3. Select (enable) option Add localhost in URL


DONE. The remainder is FYI of how and why.


Note: localhost/myproject.php or myproject.php. Although the solution was already accepted, I saw some posts that got me confused. The accepted solution is based on a single project wrt different server applications, based on the OP's specific question, and how to influence that single project in question. But all the other solutions are hacks and don't really answer the solution to the OP's question, but do bring up a good point about the URL. So, according to the other "solutions", here is how to toggle the localhost reference in the URL. Hence my additional solution added to the mix.


This is a toggle switch.

Troubleshooting Process (no hacking involved):



Let's peek at the index.php

enter image description here


Let's look at the config file. Note the variables and Array?

enter image description here


Here is the array. A variable used earlier. Let's see... Oh, it tells us where and what to do.

enter image description here


As noted in the SOLUTION:

enter image description here

like image 195
ejbytes Avatar answered Nov 15 '22 14:11

ejbytes