Help fix redirect issues please


#1

I’ve just installed free SSL with letsencrypt on my digitalocean ubuntu 14 droplet and I’d like to iron out some kinks if possible please advise!

Issue 1
When I go to -
http://test. com/images
it goes to -
http://www.test. comimages

For some reason the forward slash before images is being removed. This is the correct redirect -
https ://www.test. com/images/

Issue 2
For some reason I can’t get the Google custom URL to work with https. The domain needs to go to -
http ://mail. test. com
but the browser always loads -
https ://mail. test. com

Here’s a link to someone with the same issue and a solution is recommended but I’m not sure how to implement option 1 -
https://productforums.google.com/forum/#!topic/apps/KnNc7HRLugo

  1. configure your own web server which accepts connections on port 80 HTTP and (using a valid SSL certificate for [mail. example .com](http ://mail .example. com/) that you’ve purchased) on port 443 HTTPS. The web server should redirect all requests to https :// mail. google. com/a/ example .com.

Here’s the config file -

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName test. com
    Redirect permanent / http://www .test. com
SSLCertificateFile /etc/letsencrypt/live/test. com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test. com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/test. com/chain.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerAdmin admin@test. com
	ServerName www.test. com
	DocumentRoot /sites/test/public_html
	<Directory />
		AllowOverride All
	</Directory>
	<Directory /sites/test/public_html>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride all
		Require all granted
                Options All -Indexes
	</Directory>
	ErrorLog /var/log/apache2/test. com-error.log
	LogLevel error
	CustomLog /var/log/apache2/test. com-access.log combined
SSLCertificateFile /etc/letsencrypt/live/test. com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/test. com/chain.pem
</VirtualHost>
</IfModule>

Also I was wondering can I add the following command globally to all sites on the server in 1 config file? This command is so users can’t view all files in a directory -

Options All -Indexes

Can it be added here?
000-default.conf

Thanks in advance

P.S.
How annoying -

Sorry, new users can only put 2 links in a post.

I’ve added spaces to the URLs sitepoint thinks I am a new user! I can’t login to my old account since the forum did an upgrade :frowning:


#2

I install a certificate from the command line by calling certbot which lists all the URLs available. Typing the relevant associated numbers separated by a space, followed by enter then gives options to reinstall and possibly overwrite the existing certificate.

Try deleting the existing 443 config file and ensure all links work as expected. Once satisfied then try reinstalling the certificate.

It is possible to combine certificates and this has caused problems so I now have separate certificates for each URL.

It is also possible to set a common directive to allow users to view directory contents in the global config file of the parent sites_available folder.

I use the following site to check that the htaccess file is working correctly:

https://supiet2.tk/