Project link to local site broken
Posted by: AlanStan (---.click-network.com)
Date: October 01, 2015 06:15AM

Hello all,

My hard drive crashed and I had to reinstall Wampserver (WS). I had had WS on my system before, and it worked well. I maintain local versions of several websites that I administer as a backup of the online sites.

I was able to reinstall WS and restore my backup sites to the appropriate WAMP subfolder. However, I’ve noticed a few quirks in WS since then.

When I start WS and click the green icon, “localhost” comes up fine (http://localhost/).

However, when I click on the project called “tentcitytacoma.net,” I get the on-line version of my project instead of the local one. The URL of the online version is (http://tentcitytacoma.net/), and the URL of the local version is (http://localhost/tentcitytacoma.net/). The only way I can see the local version is if I type (http://localhost/tentcitytacoma.net/) into the address bar. Then I get the local version.

For some reason, the link on the WS page that I get by clicking the green icon does not go to the local version. I have the same problem with other local-vs-remote sites.

So, I did a bit of poking around and decided to do a bit of surgery on my hosts file. Here is what it looks like:

*******************************
****BEGIN HOSTS FILE TEXT****
*******************************
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 local.tentcitytacoma.net
******************************
****END HOSTS FILE TEXT****
******************************

This alteration made absolutely no difference at all. Why is this happening and how can I fix it? Can anyone offer me any suggestions?

Regards,
Alan

Options: ReplyQuote
Re: Project link to local site broken
Posted by: RiggsFolly (---.as43234.net)
Date: October 01, 2015 09:49AM

Hi Alan

Read this Sticky Post WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts

That should explain what you should do

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Project link to local site broken
Posted by: AlanStan (---.click-network.com)
Date: October 01, 2015 11:19AM

Thanks for the quick response and interesting link, RiggsFolly.

The problem is that suddenly, for no reason I can determine, clicking on a link under "Your Projects" on the WAMPSERVER Homepage links to an on-line site instead of the local site. Let me emphasize that this change is sudden and unexplained.

The proposed solution that you linked to seems quite fiddly to me. I'm one of those relative beginners, and so I have a few questions to ask.

1) Right now, I have a desktop (Win 7) and a laptop (Win 8.1). My main computer is the desktop. It was the desktop whose hard disk went kaflooy.

Before I replaced the hard drive, WS (WampServer) worked perfectly with my local sites. Previous to that crash, I had developed several WordPress sites using WampServer and had had no problems transferring them to the live site at the appropriate time. When I replaced the hard drive, I used the same version of WS, and the OS was imaged over to the new drive. So everything seems the same as before, but the behavior suddenly changed. Why the difference in behavior?

2) I also have the same version of WS installed on the laptop, along with the same local websites. Everything functions well there WITHOUT having made any of the changes recommended in the link you provided. Why do I not have the same problem on the laptop as I'm having on the desktop?

3) Before the crash, I had had the local version of the tentcitytacoma.net located in "C:\wamp\www\tentcitytacoma". However, the PermaLinks in WordPress did not work. In order to get them to work, I had had to set up the PermaLinks as "default" instead of "day and name."

But when I changed the folder name to "C:\wamp\www\tentcitytacoma.net" and reinstalled my backup WordPress site, everything worked well with PermaLink redirections. That's because the local folder name reflected the on-line site name.

That's why I wanted to use the same folder name as the website name. But your proposed solution rules that out.

The directions you provide say that the two destinations need separate names. If I make the recommended changes, how can I get it so that (http://localhost/tentcitytacoma.net) always resolves to the local site and (http://tentcitytacoma.net) always resolves to the on-line site? How can I get it so that clicking on the "tentcitytacoma.net" link on the "Your Projects" page resolves to the (http://localhost/tentcitytacoma.net)?

I have plenty of other questions, too. However, they can wait until these are resolved.

Regards,
Alan

Options: ReplyQuote
Re: Project link to local site broken
Posted by: RiggsFolly (---.as43234.net)
Date: October 01, 2015 01:42PM

You dont mention what version of WAMPServer you are using?

But if you have an exact copy on a laptop can I suggest this solution to your rebuild of the desktop.


If the laptop has WAMPServer installed on the same drive letter that you want to use on the Desktop, try this, if you want to move to a different drive letter this will not work :-


Uninstall WAMPServer on the desktop.

Manually Delete Desktop\wamp folder to remove any files not removed by the uninstall

Copy Laptop:wamp folder to Desktop:wamp folder

Place C:\wamp\wampmanager.exe as a shortcut onto your desktop.

Launch Wampserver from this icon

Using the wampmanager menus do

wampmanager -> Apache -> Service -> Install Service
wampmanager -> MySQL -> Service -> Install Service

wampmanager -> Start all Services


You will then have an exact duplicate of your laptop WAPServer environment (working as you like it) on your desktop. Any differences in how it runs will then be down to something other than WAMPServer.


As to the use of Virtual Hosts, this is a strong suggestion, that we give specifically, but not exclusivly, to WordPress users. We do this because lots of beginners on WP have problems moving sites from the local testing environment to a live hosted server. But they are just suggestions and if you wish to ignore it, thats your preogative.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Project link to local site broken
Posted by: AlanStan (---.click-network.com)
Date: October 01, 2015 11:02PM

Thanks for the suggestions, RiggsFolly. I appreciate the promptness of the reply.

I'll try out your suggestions. Right now, I'm kind of slammed with deadlines, and so it will be a few days. If you think it appropriate, I can report on the results. I'm using the 32-bit build of WampServer 2.5. As I mentioned before, the desktop is running Windows 7 64-bit and the laptop is running Windows 8.1.

Regards,
Alan

Options: ReplyQuote
Re: Project link to local site broken
Posted by: AlanStan (---.click-network.com)
Date: October 06, 2015 12:42PM

I'm still slammed with deadlines. I'll get to this in a few days.

Alan

Options: ReplyQuote
Re: Project link to local site broken
Posted by: AlanStan (---.click-network.com)
Date: October 14, 2015 12:30AM

I found the fix to this vexing problem on this site:
[stackoverflow.com]

What I needed to do was this:
1) Open C:\wamp\www\index.php and go to line 30.
2) Change that line from "$suppress_localhost = true;" to "$suppress_localhost = false;"

That's it! All the other folderol was completely unnecessary.

By the way, all of the commented lines are in French, a language I do not understand. It would be great if the English-language package had the instructional comments in the English language.

Regards,
Alan

Options: ReplyQuote
Re: Project link to local site broken
Posted by: Otomatic (Moderator)
Date: October 14, 2015 10:09AM

Hi

NO, NO, NO and NO! Add "localhost" in the URL is DEFINITELY a very bad solution. This exposes you to errors and problems.
The one and ONLY solution is to use the VirtualHost. Proofread carefully though this: The need for Virtual Host and you will understand why.
As for the comments in French, they are there for developers; users do not have to look at the code, and if they do, they can use Google Translate, it works very well.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Project link to local site broken
Posted by: RiggsFolly (---.as43234.net)
Date: October 14, 2015 12:51PM

Oto,

We have a saying in English

"You can lead a Horse to water, but you cannot make it drink"
"Vous pouvez mener un cheval à l'eau, mais vous ne pouvez pas le forcer à boire"

I wonder how well Google Translate did with that?

It seems to be 53/51 currently in favour of the lazy frig over the sensible solution judging by the upvotes on the answer he found.

Still at least that means 50% of users will not be asking why their WordPress site wont transfer to a live environment easily.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Project link to local site broken
Posted by: Otomatic (Moderator)
Date: October 14, 2015 03:29PM

Hi,

The Google translation is not so bad! In French, we say "You can not force a donkey to drink"

Translation of proverbs or sentences from one language to another is always a difficult exercise.

Sometimes I feel like Don Quixote and fight against windmills.
With Apache, there are not 36 solutions, there is only one and it is the VirtualHost.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Project link to local site broken
Posted by: RiggsFolly (---.as43234.net)
Date: October 14, 2015 05:53PM

Oto,

I TOTALLY AGREE But , its up to the individual, and it looks like we cannot make this Donkey drink

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.