Error url "Your Projects"
Posted by: yeu (151.72.111.---)
Date: May 08, 2014 05:57PM

Hi,

I can't go directly in my "Your Projects" folders (contained in www) starting from localhost homepage, because the path isn't [localhost], but it's [web-site-folder].

I use the new version 2.5.

Any suggestions?

Thanks in advance!

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: RiggsFolly (---.as13285.net)
Date: May 08, 2014 09:38PM

I am working on a document to inform people what to do with this feature.

Basically you should create a virtual host definition for each project.

Untill I get that done just enter localhost/foldername and it will work as it always used to.

---------------------------------------------------------------------------------------------
(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: Error url "Your Projects"
Posted by: Ap0calyps3 (---.access.mtnbusiness.co.za)
Date: May 09, 2014 12:56AM

I was able to fix this by going to www directory, editing index.php with following line: $suppress_localhost = true; change this to $suppress_localhost = false; Then your localhost homepage will put "localhost/project" name rather than "projectname".

What I don't know is how to fix that in the wamp tray icon menu/"My Projects". I read through the post pertaining to the new release of 2.5, and discovered the above mentioned line.

Edit:
WARNING: IF YOU FIND YOURSELF UNSURE AT ANY POINT IN BELOW INSTRUCTION DON'T DO IT. IT CAN CAUSE YOUR WAMP TO STOP WORKING. If you still want to try, give it a go, but back up the file to somewhere like your desktop until you are sure you got it working, or if not, then you can replace the broken file with the backup. It is really simply just adding localhost and /.

Okay, fixed the tray menu "My Projects"
In wamp/scripts I edit refresh.php. Go to line 651(If your file is different it will be on different line, so find "$myreplacesubmenuProjects .=" without " and then further in this line the follow the instruction), this is what I did: INSTRUCTION: I went to "Parameters: "http:// and added in "localhost/" directly after that http://

So it is like this 'http://localhost/'.$proje'
Dont cut off rest of line, the projectcontents and after must stay, just add in localhost/



Edited 7 time(s). Last edit at 05/09/2014 01:40AM by Ap0calyps3.

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: RiggsFolly (---.as13285.net)
Date: May 09, 2014 03:23AM

Actually this change was intend by the WAMPServer developers and for a good reason.

There is a problem using the localhost/project1 url and the default WAMPServer DocumentRoot in that is causes problems for some frameworks and WordPress type environments, as well as your own code if you are using code which depends on knowing anything about the server environment.

The correct solution is to create Virtual Hosts for all your projects even those that you store in the \wamp\www\project1 style folders.

When doing that the DocumentRoot is \wamp\www and that is what causes these problems.

These tools expect the DocumentRoot to be the root of the site i.e. \wamp\www\project1 so that when they use PHP variables like

$_SERVER['HTTP_HOST']
$_SERVER['SERVER_NAME']
$_SERVER['DOCUMENT_ROOT']

they get the correct answer i.e. the answer they would get on a real live server hosting just that site.

So using the localhost\project1 style url would mean these variables would return
$_SERVER['HTTP_HOST'] = localhost
$_SERVER['SERVER_NAME'] = localhost
$_SERVER['DOCUMENT_ROOT'] = C:/wamp/www

When they should return
$_SERVER['HTTP_HOST'] = project1
$_SERVER['SERVER_NAME'] = project1
$_SERVER['DOCUMENT_ROOT'] = C:/wamp/www/project1

So what you should do to make the My Projects menu work and reduce your pain in copying sites to live servers is:

Create an entry in the HOSTS file for each project like so and remember to create one for access via IPV4(127.0.0.1) and one for access via IPV6 (::1):-

127.0.0.1 localhost
127.0.0.1 project1

::1 localhost
::1 project1

Remember to refresh the Windows DNS Cache after any change to this file like so :-

Start a command window using Run as Administrator and run :-
net stop Dnscache
net start Dnscache


Now you must create a Virtual Host definition, so edit the \wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhost.conf file ( apache versions may differ )

Delete the default stuff in there the first time you do this. And then create your Virtual Host definitions like so :-

#
# Use name-based virtual hosting.
# This next line is not required if you are using Apache 2.4.x and should be deleted
NameVirtualHost *:80

## should be first so the wamp menu page loads and is the default site
## should also never be changed from only allowing access from the local machine
## for a bit of extra security from casual ip address probing
<VirtualHost *:80>
    DocumentRoot "C:/wamp/www"
    ServerName  localhost
    ServerAlias localhost
    <Directory  "C:/wamp/www">
        AllowOverride All

        <IfDefine APACHE24>
            Require local
        </IfDefine>

        <IfDefine !APACHE24>
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1 localhost ::1
        </IfDefine>
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/project1"
    ServerName  project1
    ServerAlias project1
    <Directory  "C:/wamp/www/project1">
        AllowOverride All

        <IfDefine APACHE24>
            Require local
        </IfDefine>

        <IfDefine !APACHE24>
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1 localhost ::1
        </IfDefine>

    </Directory>
</VirtualHost>

Now you need one more change, you must uncomment the line in httpd.conf that includes the above file we have just changed. So edit the httpd.conf file, use the wampmanager menus to do this as it ensures you edit the correct file.

Find this line #Include conf/extra/httpd-vhosts.conf and remove the comment '#' symbol from the beginning of the line like so :-

Include conf/extra/httpd-vhosts.conf
Now of course you will need to restart Apache so that it picks up your configuration changes.

If Apache does not restart, you probably made a mistake in the config, to find out what is wrong try this.

Open a command window and CD into the \wamp\bin\apache\apache2.4.9\bin folder.

Then run this :-
httpd -t
If the error is in httpd.conf or the httpd-vhost.conf files it will tell you the error and also give you the line number to make finding the error very easy.

---------------------------------------------------------------------------------------------
(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-



Edited 4 time(s). Last edit at 05/27/2014 05:48PM by RiggsFolly.

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: Ap0calyps3 (---.dynamic.isadsl.co.za)
Date: May 09, 2014 03:37AM

The changes I can revert when I figure out your intended way grinning smiley

Virtual Host definition example

In what folder and file would this example be tried, modified for my project folder?

Well, i tried doing this in httpd-vhosts found in C:\wamp\bin\apache\apache2.4.9\conf\original\extra and C:\wamp\bin\apache\apache2.4.9\conf\extra and added the entries to hosts file, but firefox still ends up saying Firefox can't find the server at www.status_test.com. Is there meant to be www and .com added? Normally browsers do this, so how will it look at the one hosted on my pc? I tried put www.status_test.com in hosts, but no luck.



Edited 5 time(s). Last edit at 05/09/2014 04:15AM by Ap0calyps3.

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: RiggsFolly (---.as13285.net)
Date: May 09, 2014 04:20AM

I have just re-written the previous thread, I hope it is now easy to follow.

---------------------------------------------------------------------------------------------
(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: Error url "Your Projects"
Posted by: yeu (151.72.50.---)
Date: May 09, 2014 11:38AM

Thanks to all for replies and thank you a lot to RiggsFolly for your fix! smiling smiley

I'll try to follow your steps.

But... Will this issue be fixed in the future versions of WAMP? :/



Edited 1 time(s). Last edit at 05/09/2014 11:44AM by yeu.

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: RiggsFolly (---.as13285.net)
Date: May 09, 2014 01:46PM

It is not an issue. So this is the way WAMPServer will now work.

It is an intended feature, to encourage people to use the proper way of configuring a project so that it matches the environment that you will find if you copy a project to a Hosted Server.

Remember, if you dont like it you can always just keyin http: // localhost/project1 and your site will run just as before. With all the potential problem that are associated with developing a site in a different environment to that which exists on a live server.

There are other benefit to doing this:-

If you are actually using WAMPServer to host a live site, you can edit the Virtual Hosts definition of just that one site and "Allow from all" or "Require all granted". This will not effect any other site you are develping.
So it makes it easy to have a live site and a development/test version of that same site on the same machine but where you cannot see the test site from an external address.

It also makes hosting that live site easier, you just use something like this in the live sites VHOST def

ServerName www.livesite.tld
ServerAlias livesite.tld

And this in the test VHOST def

ServerName www.livesite.dev
ServerAlias livesite.dev

Apache will then make the decision, based upon the url to direct a browser to the correct site, and collect all the correct environment for that site, and apply all the correct security to that site.
Changing httpd.conf securities will effect every site under the \wamp\www folder not just the one you intended.



Take a look at the Apache manual, there are all sorts of things you can tailor from a Virtual host to make each site you run as exact a copy of its eventual home. This without effecting any of uour other site.

I have used VHOST for all the sites I have been engaged to develop/fix and the concept is invaluable.

Once you have the first one up and running its a 2 minute job to copy/paste a new one. You can have as many as you need. I dont know of a limitation.



PS.
I do not recommend hosting sites accesible from the internet with WAMPServer on a desktop/workstation OS as it is just to difficult to secure the environment properly. This is of course because Windows desktop OS's where never designed to keep people out, more they were designed to make things easy for very basic users with little or no understanding of anything about computers.
Thats why we all use Windows and not a free unix distro.
Windows servers are a different thing

---------------------------------------------------------------------------------------------
(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: Error url "Your Projects"
Posted by: yeu (151.56.236.---)
Date: May 12, 2014 09:39AM

Ah ok,

thank you RiggsFolly for explaining. winking smiley

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: primal (---.20-162-184.mc.videotron.ca)
Date: August 25, 2014 04:26AM

If you are actually using WAMPServer to host a live site, you can edit the Virtual Hosts definition of just that one site and "Allow from all" or "Require all granted". This will not effect any other site you are develping.
So it makes it easy to have a live site and a development/test version of that same site on the same machine but where you cannot see the test site from an external address.

It also makes hosting that live site easier, you just use something like this in the live sites VHOST def

ServerName www.livesite.tld
ServerAlias livesite.tld

And this in the test VHOST def

ServerName www.livesite.dev
ServerAlias livesite.dev

Apache will then make the decision, based upon the url to direct a browser to the correct site, and collect all the correct environment for that site, and apply all the correct security to that site.
Changing httpd.conf securities will effect every site under the \wamp\www folder not just the one you intended.


HUH ??? can you differentiate a little more between the two VHOST def files you have written above, I'm not understanding where you have to place the server names & aliases

of course it may be late and I'm tired, or alternatively slightly retarded...

Where is the VHOST def file and where is the test VHOST file located ??

... I used this tutorial for setting up virtual hosts as described and it worked perfectly ( Excellent tutorial !!! )... I just wanna go live with it and can't understand what you're explaining with these two files....

Thank you.

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: sameerchowdhury (---.196.97.14-tataidc.co.in)
Date: January 15, 2015 04:22PM

worked for me

Options: ReplyQuote
Re: Error url "Your Projects"
Posted by: drakonfg (---.virtua.com.br)
Date: May 14, 2015 04:15AM

Hi!
I am having a similar problem here.
I tried to do, i followed step by step of RiggsFolly Wrote about.

It fixed a little, but not everything.

How so...
Now when I go to wampserver -> Localhost
It open's the menu in the browser, so I clik on Project1 in the My Project list.
HE WORKS! GREAT! Before it didn't.

BUT! When I go to wampserver -> My Project -> Project1.
He goes to WampServer Localhot page.

sad smiley

Options: ReplyQuote


Sorry, only registered users may post in this forum.