Project Links do not work on Wamp Server

2018-12-30 23:39发布

I am installing the Wamp Server on another computer to run a mid-sized database and UI. I have been successful in blocking IIS and routing the server to Localhost:8080. But whenever I try to access on of my projects from the localhost homepage, in the www file; I get redirected to a Page not found error.

When I hover above the links the directory always comes up "http:// ProjectFolderNameHere /". when it's supposed to be "http:// LocalHost:8080 / ProjectFolderNameHere /". What can I do to get the links working properly?

My Machine runs on Windows 7 Home Edition 64-bits, and I already have Microsoft's IIS disabled.

13条回答
永恒的永恒
2楼-- · 2018-12-31 00:10

Hello you need to open the index.php from the wamp server and change $suppress_localhost = false; from $suppress_localhost = true; then your wamp will working fine

查看更多
萌妹纸的霸气范
3楼-- · 2018-12-31 00:11

In order to access project from the homepage you need to create a Virtual Host first.

Most easiest way to do this is to use Wamp's Add a Virtual Host Utility.

Just follow these steps:

  1. Create a folder inside "C:\wamp\www\" directory and give it a name that you want to give to your site for eg. 'mysite'. So the path would be "C:\wamp\www\mysite".
  2. Now open localhost's homepage in your browser, under Tools menu click on Add a Virtual Host link.
  3. Enter the name of the virtual host, that name must be the name of the folder we created inside www directory i.e. 'mysite'.
  4. Enter absolute path of the virtual host i.e. "C:\wamp\www\mysite\" without quotes and click the button below saying 'Start the creation of the VirtualHost'.
  5. Virtual Host created, now you just need to 'Restart DNS'. To do this right click the wamp server's tray menu icon, click on Tools > Restart DNS and let the tray menu icon become green again.
  6. All set! Now just create 'index.php' page inside "C:\wamp\www\mysite\" directory. Add some code in 'index.php' file, like
    <?php echo "<h1>Hello World</h1>"; ?>

Now you can access the projects from the localhost's homepage. Just click the project link and you'll see 'Hello World' printed on your screen.

查看更多
旧人旧事旧时光
4楼-- · 2018-12-31 00:14

I believe this is the best solution:

Open index.php in www folder and set

change line 30:$suppress_localhost = true;

to $suppress_localhost = false;

This will ensure the project is prefixed with your local host IP/name

查看更多
唯独是你
5楼-- · 2018-12-31 00:16

Navigate to your www directory (if you are using wamp server) htdocs (if on XAMPP). Open your admin.php and search on project contents/ or just go directly to line number 339 and change the link, inserting 'local host to the link .

That should work ,,

查看更多
梦醉为红颜
6楼-- · 2018-12-31 00:19

This works on Wamp 3+.

  • Go to wamp folder (wamp/ or wamp64/)
  • Open wampmanager.conf
  • Find urlAddLocalhost param and set it on: urlAddLocalhost = "on"

There should not be the need to tweak the index.php in www folder.

查看更多
忆尘夕之涩
7楼-- · 2018-12-31 00:20

Re: Wampserver LocalHost links not working correctly
This is as of June 2014 with Wampserver2.5 (maybe they'll fix this in later builds).
Note: to use LocalHost:8080 instead of LocalHost just make the appropriate changes in the edits mentioned below.

There are 2 aspects of this issue -
The first is to be able to access items under "Your Projects" from the Wamp localhost homepage.
The second is to be able to correctly access items listed in the Wampserver Icon Taskbar's "My Projects" list.

To fix the first (to be able to access items under "Your Projects" from the Wamp localhost homepage) you will need to do the following...

There are 2 edits that you must make in the index.php file located in your wamp\www folder (usually C:\wamp\www)

1) on Line 30 change

  $suppress_localhost = true;

to

  $suppress_localhost = false;

2) on line 338 change

  $projectContents .= '<li><a href="'.($suppress_localhost ? 'http://' : '').$file.'">'.$file.'</a></li>';

to

  $projectContents .= '<li><a href="'.($suppress_localhost ? 'http://' : 'http://localhost//').$file.'">'.$file.'</a></li>';

After you've made the above edits - if the Wampserver is running just refresh the local host page and the changes become immediately effective.

To fix the 2nd item (the Wampserver Icon Taskbar's "My Projects" list): You need to edit C:\wamp\scripts\refresh.php

Locate line 651 and change the section of the line that reads

   Parameters: "http://'.$projectContents[$i].'/"; Glyph: 5

to

   Parameters: "http://localhost//'.$projectContents[$i].'/"; Glyph: 5

After you make these 2nd set of changes you may have to force Wampserver to refresh the "My Projects" list by toggling the Put Online/Offline option at the bottom of the Wamp Icon Tray App.

查看更多
登录 后发表回答