Direct links lead to /home on first load

Hey guys,

On my page I have a subpage, now when I send someone that direct link to somepage…com/press, it will always load somepage…com at first, then the second time when somepage…com/press is entered, it actually loads that subpage…

I tried playing around with routes and redirects of site.yaml and htcaccess, but without success.

Can you give me a hint on why this behaviour happens? Because I have no clue at the moment…

Thanks, Vincent

(the double dots in the links are due to “new users can only post two links in a post”)

I’m running on
Grav v1.6.28
Nginx 1.10.3
PHP 7.1.33
Ubuntu 16.0.4

Hi @vince

Can you share the actual link so we can get a better read on the problem?

– phi

yes, sure.

So the direct link I want to send to people is
On first visit that link it will redirect to, when you then type in the /presse it will lead you to the actual subpage

Edit: That actually happens with all subpages, maybe it’s just a simple caching problem…?

On my first visit to after clicking your link, I believe I received the correct page:

Same for both firefox and chrome.

Did you try clearing your browser cache?

Hmm you’re right, it leads to the correct page.
However, when I type in the url (including subpage and after clearing browser cache) by hand it redirects to the mainpage…
That’s really weird, but I guess I can live with that as long as clicking the links works.

Thank you very much

Just had a hunch -

If I type in or without https, it redirects to your homepage with https.

Check your force_ssl setting in your system.yaml and your .htaccess?

1 Like

Damnit, now I feel stupid… :sweat_smile:

It wasn’t in the grav configuration, but in the nginx server block.
I simply forgot to put “$request_uri” after “return 301 https://$host” when redirecting from http to https, so of course it would just redirect to the mainpage.

You brought me on the right track here, awesome! Thanks again!

@vince - Glad it worked!

There are so many knobs and switches on these contraptions. Hard to get to a handle on all of it.