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

Typing subpages with forced SSL redirect end up 404’ing (htaccess issue?)

apache

Solved by Andy Miller View solution

Started by Slavisa Petrovic 9 years ago · 3 replies · 1278 views
9 years ago

I'm using the following in my .htaccess to force SSL:

TXT
# Redirect to HTTPS
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
## End - Index

However, I'm running into an issue with subpages. For example,

"example.com" --> "https://www.example.com"
without issue, but any subpage like typing

"example.com/about-us" --> 404 "https://www.example.com/index.php"
This is even the case for straight www URLs without the "https", which is why I assume it may have to do with how I'm handling the redirects.

I'm admittedly not that well versed with the .htaccess file, but does this seem like something to do with that or something to do with my certificates or other grav-level settings? Thanks in advance!

👍 1
9 years ago

Grav has an option to force SSL in Configuration > System

That might solve your problem!

9 years ago Solution

Make sure you put this SSL rewrite ABOVE the regular Grav rewrite for index.php

Suggested topics

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