I’m having an issue I can’t solve. I have a number of Wordpress sites running on a TKL LAMP instance. If the root page is requested, or the link/manually typed URL includes https, they are being forwarded to the https version of the site properly. However, if one simply types www.mysite.com/coolpage/ (without the https) the server responds to the http request and then forwards to the https version, but it strips out any slashes in the URL – so you wind up going to https://www.mysite.comcoolpage which obviously doesn’t work.
Any idea on what I’ve done wrong?
Here is my .htaccess
# 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
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
## Wordfence WAF
<IfModule mod_php5.c>
php_value auto_prepend_file '/var/www/Mysite.com/htdocs/wordfence-waf.php'
</IfModule>
<IfModule mod_php7.c>
php_value auto_prepend_file '/var/www/Mysite.com/htdocs/wordfence-waf.php'
</IfModule>
<IfModule mod_php.c>
php_value auto_prepend_file '/var/www/Mysite.com/htdocs/wordfence-waf.php'
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
And here is my website’s config file (edited for privacy)
<VirtualHost *:80>
ServerName Mysite.com
ServerAlias www.Mysite.com
Redirect / https://www.Mysite.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.Mysite.com
ServerAlias Mysite.com
ServerAdmin me@Mysite.com
DocumentRoot /var/www/Mysite.com/htdocs
SSLEngine on
ServerAdmin me@mysite.com
Alias /.well-known/acme-challenge /var/www/lets-encrypt
<Directory /var/www/lets-encrypt>
Options None
AllowOverride None
Require all granted
</Directory>
SSLCertificateFile /var/lib/dehydrated/certs/mysite.com/fullchain.pem
SSLCertificateKeyFile /var/lib/dehydrated/certs/mysite.com/privkey.pem
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
CustomLog /var/log/apache2/Mysite.com-access.log combined
ErrorLog /var/log/apache2/Mysite.com-error.log
LogLevel warn
</VirtualHost>