Stylesheets don't load on remote access
Posted by: seanfilidis (---.cable.dynamic.v4.ziggo.nl)
Date: February 19, 2018 09:30PM

Hey guys,

I'm trying to make my project accessible to other devices on my local network.

When I access my website via another device, the page loads, but with no styling, and I can't figure out why.

It's a wordpress site.

Here is the contents of my httpd-vhosts.config. The first entry I left as is. The second entry is so that I can access my project on the same computer more easily. The third entry is my attempt to make it remotely accessible.

# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName 30days.here
ServerAlias 30days.here
DocumentRoot "${INSTALL_DIR}/www/wordpress/"
<Directory "${INSTALL_DIR}/www/wordpress/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost 192.168.178.185:80>
DocumentRoot "${INSTALL_DIR}/www/wordpress/"
<Directory "${INSTALL_DIR}/www/wordpress/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>


In my httpd.conf I changed my server name from localhost to my IP address, 192.168.178.185, and I set Require all granted.

Any clue what I'm doing wrong?

Again, if I navigate to 192.168.178.185 from another device, the page loads, but the stylesheets don't.

Thanks for the help.

Options: ReplyQuote
Re: Stylesheets don't load on remote access
Posted by: Otomatic (Moderator)
Date: February 20, 2018 09:45AM

Hi,

What I can already say is that your VirtualHost has not been created or added by the tool integrated in Wampserver ('http://localhost/add_vhost. php'); if that had been the case, there would be no errors.

> DocumentRoot "${INSTALL_DIR}/www/wordpress/"
Don't put any trailing slash on the path to DocumentRoot.
See http://httpd.apache.org/docs/2.4/en/mod/core.html#documentroot

> <VirtualHost 192.168.178.185:80>
Where is ServerName for this VirtualHost?
If no ServerName is specified, the server attempts to deduce the client visible hostname by first asking the operating system for the system hostname, and if that fails, performing a reverse lookup on an IP address present on the system.

> In my httpd.conf I changed my server name from localhost
> to my IP address, 192.168.178.185,
Except for very special (and very rare) cases, you don't have to modify httpd.conf "by hand"; the tools built into Wampserver do it wherever you need to do it.

And, with all your "by hand" modifications, have you modified the C:\Windows\System32\drivers\etc\hosts file as it should be?
Because there too, the tools built into Wampserver do it very well, even with VirtualHost over IP.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.33 - PHP 7.2.5/7.1.17/7.0.30/5.6.36 - MySQL 5.7.22 - MariaDB 10.2.15
Wampserver 3.1.3 64 bit - Apache 2.4.33 - PHP 7.2.5/7.1.17/7.0.30/5.6.36 - MySQL 5.7.22 - MariaDB 10.2.15
PhPMyAdmin 4.8.0.1 - 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: Stylesheets don't load on remote access
Posted by: seanfilidis (---.cable.dynamic.v4.ziggo.nl)
Date: February 20, 2018 09:04PM

Thanks for your reply.

Okay, I reverted all my changes:
- Deleted the extra entries I made to httpd-vhosts.conf
- Changed my server name back to localhost:80 in httpd.conf
- Deleted entry I had made to my hosts file

I now used the WAMP Virtual Hosts tool to add an entry:
- It would not let me use my IP address as a server name, so I just entered 'test'.
- I set the path to C:/wamp64/www/wordpress

Now, my vhosts file looks like this:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>


#
<VirtualHost *:80>
ServerName test
DocumentRoot "c:/wamp64/www/wordpress"
<Directory "c:/wamp64/www/wordpress/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

I see it automatically added the following lines to my hosts file as well:

127.0.0.1 test
::1 test

So, now, I can enter [test] and get to my project as long as I am on the same computer. But this doesn't help me.

I want to access my project from other devices on the network via my server's IP. Right now, if I type 192.168.178.185 into a browser on another device, I get a 403 Forbidden error.

What am I missing?



Edited 1 time(s). Last edit at 02/20/2018 09:27PM by seanfilidis.

Options: ReplyQuote
Re: Stylesheets don't load on remote access
Posted by: Otomatic (Moderator)
Date: February 20, 2018 09:45PM

Hi,

For access from LAN, for your VitualHost test replace :

Require local

by

Require local
Require ip 192.168

(if 192.168.0.0 to 192.168.255.255 is the range of IP's from your LAN devices)

From LAN devices you have to type 'http://192.168.178.165/test/'

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.33 - PHP 7.2.5/7.1.17/7.0.30/5.6.36 - MySQL 5.7.22 - MariaDB 10.2.15
Wampserver 3.1.3 64 bit - Apache 2.4.33 - PHP 7.2.5/7.1.17/7.0.30/5.6.36 - MySQL 5.7.22 - MariaDB 10.2.15
PhPMyAdmin 4.8.0.1 - 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: Stylesheets don't load on remote access
Posted by: seanfilidis (---.cable.dynamic.v4.ziggo.nl)
Date: February 20, 2018 10:51PM

Hey,

Made the edit. Restarted WAMP.

Still getting 403 Forbidden at 192.168.178.185/test from other devices on the LAN.

Options: ReplyQuote
Re: Stylesheets don't load on remote access
Posted by: Otomatic (Moderator)
Date: February 21, 2018 09:11AM

Hi,

Try to replace:
<VirtualHost *:80>
  ServerName test
  DocumentRoot "c:/wamp64/www/wordpress"
  <Directory "c:/wamp64/www/wordpress/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>
by
<VirtualHost *:80>
  ServerName test
  DocumentRoot "c:/wamp64/www/wordpress"
</VirtualHost>

<Directory "c:/wamp64/www/wordpress/">
  Options +Indexes +Includes +FollowSymLinks +MultiViews
  AllowOverride All
  Require local
</Directory>

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.33 - PHP 7.2.5/7.1.17/7.0.30/5.6.36 - MySQL 5.7.22 - MariaDB 10.2.15
Wampserver 3.1.3 64 bit - Apache 2.4.33 - PHP 7.2.5/7.1.17/7.0.30/5.6.36 - MySQL 5.7.22 - MariaDB 10.2.15
PhPMyAdmin 4.8.0.1 - 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: Stylesheets don't load on remote access
Posted by: seanfilidis (---.cable.dynamic.v4.ziggo.nl)
Date: February 21, 2018 07:56PM

Well, that did something.

Now, when I navigate to 192.168.178.185/wordpress from another device, like my iPad, it redirects to localhost/wordpress.

Obviously, there is no localhost/wordpress on my iPad, so it just says site can't be reached.



Edited 1 time(s). Last edit at 02/21/2018 07:56PM by seanfilidis.

Options: ReplyQuote
Re: Stylesheets don't load on remote access
Posted by: RiggsFolly (Moderator)
Date: February 22, 2018 12:29AM

This is totally wordpress. As it was installed into localhost/wordpress it remembers that url and uses in on all sorts of urls and links.

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (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-

Options: ReplyQuote
Re: Stylesheets don't load on remote access
Posted by: seanfilidis (---.cable.dynamic.v4.ziggo.nl)
Date: February 22, 2018 08:45AM

That's what was missing!

I set WP_HOME and WP_SITEURL to 192.168.178.185/wordpress in my wp-config file, and now it works.

I can't believe how many websites I visited, posts I read, and videos I watched. None of them could provide full working instruction.

Thanks guys.

Options: ReplyQuote


Sorry, only registered users may post in this forum.