Install grav in a secondary directory

Hi,
I need to install grav in a secondary directory.
I tried different ways but nothing.
Where and what I have to change?
Everytime grav system get out a terrible error 404…

Help, please!

The same problem.
GRAV installed in the subfolder “html/demo”
“html” - is root hosting folder, like “www”, “public” etc.
Index page at “http://domen.com/demo” opens successfully.
In main menu the absolute links like “/blog”, “/services”, etc.
The links works “http://domen.com/blog”, “http://domen.com/services
instead “http://domen.com/demo/blog”, “http://domen.com/demo/services”. I tried to change the site URL in system.yaml and htaccess, the routing from admin-panel. I think it’s a simple task, but I can’t solve it. I tried a lot of options reading the documentation.

Have you also tried setting ‘Custom base URL’ setting in the system configuration?

I just tried it again. Still treated as “domain.com/blog

Are you using a custom theme?

Yes. Like described on https://getgrav.org/blog/theme-development-with-inheritance.
from user/config/system.yaml
“pages:
theme: areal
order:
by: default
dir: asc”

Ok. It is quite likely that your theme is creating links with href=/blog etc. Can you post the theme’s navigation snippet?

{% macro nav_loop(page) %}
{% for p in page.children.visible %}
{% set active_page = (p.active or p.activeChild) ? ‘active’ : ‘’ %}
{% if p.children.visible.count > 0 %}



  • {{ p.menu }}


      {{ _self.nav_loop§ }}


  • {% else %}


  • {{ p.menu }}


  • {% endif %}
    {% endfor %}
    {% endmacro %}
      {{ _self.nav_loop(pages) }}

    But I’m using absolute links in menu, like:

  •                     <a class="nav-link" href="/blog">Blog</a>
                    </li>
                    <li class="nav-item ">
                        <a class="nav-link" href="/forms/contact">Contact</a>
                    </li>
  • Alright. Just update the links like so -

    <a class="nav-link" href="{{ base_url }}/blog">Blog</a>
    1 Like

    Great success! It works! :joy: How can I thank you?