Virtual host necessary for simple root-relative URLs to work?
Posted by: FrankC (41.86.17.---)
Date: May 24, 2018 06:17PM

In XAMPP, one has to create a virtual host to make root-relative URLs work locally as well. Without it, a link like

<script src="/x-files/pretext-script.js"></script>

will work fine on the remote server, but on the local server will throw an error:

Loading failed for the <script> with source "localhost/x-files/pretext-script.js"

How is that in WAMP?

Options: ReplyQuote
Re: Virtual host necessary for simple root-relative URLs to work?
Posted by: Otomatic (Moderator)
Date: May 24, 2018 06:29PM

Hi,

How would you want relative urls to work properly if you don't define DocumentRoot the right way?

And the right way to define DocumentRoot is to use a VirtualHost, as with all hosts. That's why it works on your remote server even though you don't realize you're using a VirtualHost.

See The need for Virtual Host

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

Options: ReplyQuote
Re: Virtual host necessary for simple root-relative URLs to work?
Posted by: FrankC (41.86.17.---)
Date: May 25, 2018 09:37AM

Of course the server must know what the site root is. I just wanted to know whether in WAMP that has been (semi-)automated or not. Unfortunately, it hasn't. The procedure of creating a virtual host seems even more complicated than in XAMPP.

It would be a great selling point for WAMP if you could make that procedure a lot easier.



Edited 1 time(s). Last edit at 05/25/2018 09:39AM by FrankC.

Options: ReplyQuote
Re: Virtual host necessary for simple root-relative URLs to work?
Posted by: RiggsFolly (Moderator)
Date: May 25, 2018 10:46AM

Look at the WAMPServer homepage! Launch `localhost` that is the WAMPServer homepage

Look under TOOLS for an item called "Add a Virtual Host"

en voila Automation

Or if you had read what Otomatic suggested you should have found a link to [forum.wampserver.com]

---------------------------------------------------------------------------------------------
(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 1 time(s). Last edit at 05/25/2018 02:06PM by RiggsFolly.

Options: ReplyQuote
Re: Virtual host necessary for simple root-relative URLs to work?
Posted by: FrankC (41.86.17.---)
Date: May 25, 2018 01:31PM

@RiggsFolly -- Otomatic linked to another page. To [forum.wampserver.com], which is an overwhelming lot of text with numerous technical steps. Not exactly suited for a beginner in this matter who has little time, like me.

And under [wampserver.aviatechno.net] > Tools I don't see any tutorial called "Add a Virtual Host".

Options: ReplyQuote
Re: Virtual host necessary for simple root-relative URLs to work?
Posted by: RiggsFolly (Moderator)
Date: May 25, 2018 01:37PM

But if you click the link I gave you it will take you to a tutorial. The same tutorial that was linked to in the link Oto gave you.

Here is the passage from Oto's linked page:

----------------------------------------------------------------------------------------
--- With Wampserver 3.0.0 it is simplier and can be done automatically with few click:
--- see [forum.wampserver.com]
--- But this does not prevents you reading the following explanations; it will help you understand what a VirtualHost is.
----------------------------------------------------------------------------------------

And to the length, we have to write tutorials that explain the reasoning for doing this for those without your knowledge of Virtual Hosts, so they see why to do it as well as how to do it.

---------------------------------------------------------------------------------------------
(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 1 time(s). Last edit at 05/25/2018 01:37PM by RiggsFolly.

Options: ReplyQuote
Re: Virtual host necessary for simple root-relative URLs to work?
Posted by: Otomatic (Moderator)
Date: May 25, 2018 02:02PM

Hi,

> Not exactly suited for a beginner in this matter who has little time, like me.

If you do not have time to read the documentation and instructions for use, you should not engage in operations that exceed your skills.
If you had read it correctly, and not diagonally, you would have seen the link on how to add a VirtualHost.

Our parents spent hours teaching us how to go on the potty when we were in our infancy, because using the toilet is an almost essential skill in modern society.
Our teachers spent months and years teaching us to read, write and count.
In secondary school, we spent many months learning one or more foreign languages.
By majority, even after hours of accompanied driving, it took at least twenty hours of training to "know" how to drive a car.
I spent four years of apprenticeship before practicing my trade.
Nevertheless, popular belief would have us all be computer wizards in one fell swoop.
As long as we do not firmly explain that computing (yes it is very general...) is like reading, writing, counting, like a language or a culture: you have to learn and practice it for a long time to "use it" correctly, everyone will believe he is a computer scientist from the moment he uses Facebook, Twitter, Youtube, Google, and at 5% of the possibilities, Word, Excel, Powerpoint, Wordpress or Joomla.
Today, advertisers, marketers, vendors say exactly the opposite, that the computer can do everything, easily and simply, difficult to over blame the consumer.

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

Options: ReplyQuote


Sorry, only registered users may post in this forum.