WAMP - Remove localhost from project URL

前端 未结 16 1654
暖寄归人
暖寄归人 2020-12-02 11:01

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/

相关标签:
16条回答
  • 2020-12-02 11:11

    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" 
    

    0 讨论(0)
  • 2020-12-02 11:13

    If your "Your Projects" folder exists in "wamp/www/" and if you can see the localhost home page after starting wampserever correctly, and still you can't access your projects, then simply go to "wamp/www/" folder, open index.php and search for $suppress_localhost and set its value to false. Restart wampserver, go to localhost and try to access your project.

    0 讨论(0)
  • 2020-12-02 11:13

    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.

    0 讨论(0)
  • 2020-12-02 11:14

    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


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


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


    As noted in the SOLUTION:

    0 讨论(0)
  • 2020-12-02 11:14

    Create a virtualhost like RiggsFolly said.

    And try to uncomment LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf

    0 讨论(0)
  • 2020-12-02 11:18

    Your wamp seems to be configured to run a website on the normally non-existant domain helloworld.

    add:

     127.0.0.1    helloworld
    

    inside this file: c:\windows\system32\drivers\etc\hosts

    Make sure you start your text editor with administrator privileges to be able to edit that file.

    This will tell your computer that the otherwise non-existant domain helloworld should be resolved to your loop back address.

    0 讨论(0)
提交回复
热议问题