WAMP: Missing http://localhost/ in urls , wrong wamp projects links

匿名 (未验证) 提交于 2019-12-03 02:49:01

问题:

I have a problem with Wamp which never happened to me before, cannot find what's wrong. I have a few projects located in my www folder ( running windows 7 ).

My hostfile has the line 127.0.0.1 localhost uncommented

When I go to http://localhost/ or http://127.0.0.1/ and click on a project name like "mysite" from the main Wamp panel page, the link just points to "mysite" and not "http://localhost/mysite"

Therefore I can't see any sites, what should I do ?

回答1:

After thorough research, I found out the solution which worked for me as well..

open wamp/www/index.php. 

Change this line:

$suppress_localhost = true; 

To :

$suppress_localhost = false; 


回答2:

For the latest versions on Wamp, the file has changed the code as follows:

$suppress_localhost = ($wampConf['urlAddLocalhost'] == 'off' ? true : false); 

So it is now configurable from the Wamp Aestan Tray menu.

For Wampserver 3.0.6, I was able to do this by the following:

  1. Right click on wamp icon on tray on the right.
  2. Go to "wamp settings"
  3. Enable "Add localhost in URL"

If you see the green tick mark, it is enabled. Now refresh your localhost home page and check URLs.



回答3:

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"  



回答4:

Adding Localhost in url is not a suggested by wamp, wamp expect that each project contains a virtualhost.This provides a level of control for framework development. So for instance if your project is stackone, you need to create a virtual host for that called stackone:How to create a virtual host?

--Create a directory/folder in wamp64/www (example wamp64/www/projectone)

--Go to kickstart you wamp server and type localhost on your browser

--At the bottom left you should see add local virtual server. fill in the project name,(e.g projectone),fill in the path.(e.g c:\wamp64\www\projectone).click start creation.

--You will need to restart DNS. Right click on the notiication icon of wamp, hover on tools, you should see restart DNS. You can now copy your files to the directory you created. I added some images below (wamp 3.0.6)

Adding Virtual Host,Restarting DNS



回答5:

Although its not a problem. Linking been disabled by Wamp Devs. Check this article link, its well written and explained the matter.

WAMP - Remove localhost from project URL



回答6:

I prefer the end-user way to change wamp's behaviour. Right click on WAMP notification icon -> Wamp Settings -> Add localhost in url.



回答7:

In the latest version

CHANGE THIS

$suppress_localhost = ($wampConf['urlAddLocalhost'] == 'off' ? true : false); 

TO THIS

$suppress_localhost = ($wampConf['urlAddLocalhost'] == 'off' ? false : false); 


回答8:

WampServer Version 3.1.0 64bit In Wampmanager.conf you will find a line:

urlAddLocalhost = "off" 

Change it to "on" Thats it!



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!