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

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
Wampserver 3.1.3 64 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
PhPMyadmin 4.8.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

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.1.3 32bit & 64bit)
<Apache 2.4.29/2.2.31> <PHP 7.2/7.1/7.0/5.6/5.5/5.4> <MySQL 5.7.19/5.6.39/5.5.28>
<MariaDB 10.2.14> <phpMyAdmin4.8.1> <MySQL Workbench 6.3.10>

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 MySQL 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.1.3 32bit & 64bit)
<Apache 2.4.29/2.2.31> <PHP 7.2/7.1/7.0/5.6/5.5/5.4> <MySQL 5.7.19/5.6.39/5.5.28>
<MariaDB 10.2.14> <phpMyAdmin4.8.1> <MySQL Workbench 6.3.10>

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 MySQL 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.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
Wampserver 3.1.3 64 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
PhPMyadmin 4.8.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote


Sorry, only registered users may post in this forum.