Member
Member
Richardp   2018-12-06, 04:20
#1
Hi ,
I'm still having problems with the HTaccess redirection
the address is http://photosbyrichard.net.au this should redirect to the https://photosbyrichard.net.au
But it's not.
Here is the current htaccess file ..

# htaccess file version 1.4.12;
# Rewrite rules are now handled by PHP code
# See the file "zenphoto-rewrite.txt" for the actual rules
#
# These rules redirect everything not directly accessing a file to the Zenphoto index.php script
#
<IfModule mod_autoindex.c>
IndexIgnore *
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]

RewriteRule ^.*/?$ index.php [L,QSA]

</IfModule>


Can anyone help please? suggest a solution ?

Thank you
Richard
Administrator
Administrator
acrylian   2018-12-06, 10:32
#2
You should do the redirection via your host/server. You often can configure a "force ssl" or similar on your host's settings when you enable https.
Member
Member
MarkRH   2018-12-08, 00:56
#3
I've always seen it as:


RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

So, might try `%{HTTPS} off` instead of `%{HTTPS} !on`
Member
Member
Richardp   2018-12-08, 11:48
#4
Tried that didn't work
Administrator
Administrator
acrylian   2018-12-08, 13:03
#5
I have to admit I never tried it since the hosts I know do this via server side setting. But besides that I only know what @MarkRH posted.

There is also the syntax `%{HTTPS} !=on` according to the Apache wiki: https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

I am not sure what these lines are actually for?:
`RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$`
`RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$`


Maybe try to strip down to the really ZP necessary stuff and try with that.
Member
Member
MarkRH   2018-12-08, 23:20
#6
Those extra lines are from cPanel's AutoSSL process. It adds them before every single RewriteRule just about.
Administrator
Administrator
acrylian   2018-12-09, 11:38
#7
@MarkRH: Thanks, I am not familar with cPanel at all.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.