https to sub pages is 404
Posted by: PeterC66 (---.56.199.146.dyn.plus.net)
Date: March 13, 2020 07:16AM

As background: I have been a happy user of Wampserver for several years, and my redeveloped WordPress site seems to work well on it. I use a virtual server called hwnhistory. I adapted Wampserver for SSL as per [zuziko.com]. I eventually generated a satisfactory self-certified certificate when I had chased down various issues. I have tried moving my WordPress site to SSL using the Really Simple SSL plugin but get some odd behaviour that they suggest is because of my server setup, so I have uninstalled Really Simple SSL. I have found that I still get similar odd behaviour, which I cannot understand so I would like to resolve this before trying to move to SSL again.

The behaviour is:
1) When I go to 'hwnhistory' or 'http://hwnhistory/' every facet of my site works including all subpages, and it is marked as Not Secure - as expected.
2) When I go to 'https://hwnhistory/' my homepage shows OK, but it is marked as Not (Fully) Secure.
3) On every sub-page (eg 'https://hwnhistory/village/') I get a 404 (Not Found), but it is marked as Secure with a padlock.
4) When I go to 'localhost' or 'http://localhost/' I get the normal Wampserver localhost page with the Server Configuration, and it is marked with an "i" as Not Secure.
5) When I type in 'https://localhost/' it goes to 'https://hwnhistory/' and is marked as Not (Fully) Secure.

To me, this does not seem normal behaviour, and it looks as if https is causing a rewriting. How can I find out what I have done wrong? If it is expected behaviour could someone confirm it?

I am using Wampserver Version 3.2.0 - 64bit, Server Software: Apache/2.4.37 (Win64) OpenSSL/1.1.1a PHP/7.3.1 - Port defined for Apache: 80

By the way, the "odd behaviour" on SSL using Really Simple SSL I mentioned above is that when I go to [hwnhistory] my homepage shows OK, but on every sub-page I get a 404 (Not Found).


My httpd-vhosts.conf is
# 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 hwnhistory
	DocumentRoot "c:/hwnhistory"
	<Directory  "c:/hwnhistory/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>

C:\hwnhistory\.htaccess is
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# block comment spam by denying access to no-referrer requests
# From [perishablepress.com]
#RewriteEngine On
#RewriteCond %{REQUEST_METHOD} POST
#RewriteCond %{REQUEST_URI} wp-comments-post\.php
#RewriteCond %{HTTP_REFERER} !(.*)hwnhistory(.*) [OR]
#RewriteCond %{HTTP_USER_AGENT} ^-?$
#RewriteRule .* []%{REMOTE_ADDR}/ [R=301,L]



Edited 1 time(s). Last edit at 03/13/2020 10:56AM by RiggsFolly.

Options: ReplyQuote
Re: https to sub pages is 404
Posted by: RiggsFolly (Moderator)
Date: March 13, 2020 11:01AM

Hi,

Ok so where is the Virtual Host that defines the site as a secure site?

See C:\wamp64\bin\apache\apache2.4.41\conf\extra\httpd-ssl.conf

Also have a read of This page I wrote up a few years ago

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.0 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.19>

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: https to sub pages is 404
Posted by: PeterC66 (---.56.199.146.dyn.plus.net)
Date: March 14, 2020 04:50PM

Thanks. I had referred to your Step-by-Step guide during my process, and found it useful along with others that complemented it for my own circumstances.

By having a good look again at what I have done compared to your guide, and further experimentation, I now see what I have done wrong.

In the <Directory> section for my virtual host in my httpd-ssl.conf I had used a suggestion from someone else:
Require all granted
AllowOverride none

I need to change that to what you suggest:
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1

As I understand it this now lets my .htaccess directives override configuration directives, and I need this for WordPress to work correctly.

Hopefully, I can now implement SSL OK.

Options: ReplyQuote
Re: https to sub pages is 404
Posted by: RiggsFolly (Moderator)
Date: March 16, 2020 10:42AM

Hi,

Nearly !!! But no Cigar.

The command `AllowOverride` is what controls whether Apache will look at and or comply with various .htaccess instructions. As documented in The Apache Manual of all the odd places

These instructions
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1

Are irrelevant to the usage of the .htaccess file, and are in fact Apache 2.2 instructions that have been superceeded by Apache 2.4 instructions, like the ones you found in the config files originally. Dont use the Apache 2.2 instructions unless you are actually using Apache 2.2.
You will find this also documented in the Apache User Manual

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.0 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.19>

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


Sorry, only registered users may post in this forum.