edvanleeuwen
Verified User
- Joined
- Nov 18, 2013
- Messages
- 148
We have a (Drupal) site covs.nl on which all calls should be directed to https, excluding one which is a call to blad.covs.nl. We are using an A record to relate it to an externally hosted solution; this solution does not have SSL.
I have tried to adapt .htaccess with our needs. But the redirection fails for the one URL.
Relevant lines in .htaccess:
Is this the proper solution or is it not possible to use .htaccess for this purpose? What am I missing?
I have tried to adapt .htaccess with our needs. But the redirection fails for the one URL.
Relevant lines in .htaccess:
Code:
RewriteEngine on
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
# Make sure Authorization HTTP header is available to PHP
# even when running as CGI or FastCGI.
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess, because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these # directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^blad\. [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=302]
# RewriteRule ^ https://%1%{REQUEST_URI} [L,R=302]
# Blad to http
#RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^blad\.
# Direct all to SSL: https://www.drupalaid.com/blog/how-to-quickly-add-ssl-to-your-drupal-site
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^blad\.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
Is this the proper solution or is it not possible to use .htaccess for this purpose? What am I missing?