Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Installation & Hosting

SSL htaccess and subpages

apache

Started by P S 8 years ago · 1 replies · 2043 views
8 years ago

I have read all the pertinent GRAV documentation and a lot of similar posts on SSL and htaccess issues. I apologize since this topic seems common but the specific advice I found does not work and the other advice is to vague.

1) Using this to force SSL via htaccess does not work:

TXT
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=HTTPS:on]

2) using this works:

TXT
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=302,L]

3) however #2 gives me a 404 on any subpage or on the admin page

4) I enable this in htaccess:

RewriteBase /

5) #4 does not change anything

6) I do NOT see the GRAV style 404 Not Found error page. BUt the server 404 page. And I know when I flip #2 on or off, I can see the htaccess file is indeed working. But it is weird, when I put "Test." at the top of the htaccess file, it is ignored. So in some cases it is LIKE it is reading the htaccess file and in some cases it is NOT.

Any other suggestions?

I am using Rochen as my web host.

I setup the SSL using standard settings from Let's Encrypt

👍 1
last edited 04/20/18 by P S
8 years ago

I found that the either of the following worked:

TXT
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS}::%{HTTP_HOST} ^off::(?:www\.)?(.+)$
RewriteRule ^ https://www.%1%{REQUEST_URI} [NE,L,R]

The latter includes redirecting all non-www versions to the www versions.

For future reference:

https://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite#4399158

last edited 04/20/18 by P S

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 15 hours ago
5 61 9 hours ago
Installation & Hosting · by Jürgen Dietrich, 7 months ago
0 63 7 months ago
Installation & Hosting · by rappluk, 8 months ago
0 62 8 months ago
Installation & Hosting · by N, 12 months ago
3 73 12 months ago
Installation & Hosting · by Youle, 1 year ago
1 62 1 year ago