WAMP - Remove localhost from project URL

2019-01-10 09:25发布

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?

14条回答
趁早两清
2楼-- · 2019-01-10 09:36

You can update "urlAddLocalhost" variable in "wamp64/wampmanager.conf" file to on/off. By default it is "off".
My wamp version is 3.0.6.

urlAddLocalhost = "off" 

enter image description here

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-10 09:37

i also faced same problem after installing new wamp setup on window 7, 64bit. just change line no. 30 $suppress_localhost = false; Its work for me.

查看更多
干净又极端
4楼-- · 2019-01-10 09:41

For me was the easiest way go to http://localhost and in wampserver homepage use Add a Virtual Host (Tools section). There is nice and easy form to create alias without any problem (instead console when you using tray icon to create alias). No source edit, just using what wamp offers. Remember refresh DNS after creating of alias. Tested on Win10, WampServer 3.0.6 64bit.

查看更多
混吃等死
5楼-- · 2019-01-10 09:43

in your www folder open index.php at line 30 change: $suppress_localhost to be false

this is should look:

$suppress_localhost = false;

查看更多
我只想做你的唯一
6楼-- · 2019-01-10 09:43

Open index.php in www folder and set

$suppress_localhost = True;===>$suppress_localhost = false;

that is work.

查看更多
欢心
7楼-- · 2019-01-10 09:46

HostnameLookups ON not OFF in httpd.conf with DocumentRoot changed or not. tested in browser for $_SERVER['HTTP_HOST'] $_SERVER['SERVER_NAME'] $_SERVER['DOCUMENT_ROOT']

查看更多
登录 后发表回答