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

Install grav in a secondary directory

solved

Started by Gino 9 years ago · 10 replies · 1712 views
9 years ago

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!

8 years ago

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.

8 years ago

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

47%20PM|690x65

8 years ago

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

8 years ago

{% 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 %}
<li>
<a href="{{ p.url }}" class="{{ active_page }}">
{{ p.menu }}
</a>
<ul>
{{ _self.nav_loop(p) }}
</ul>
</li>
{% else %}
<li>
<a href="{{ p.url }}" class="{{ active_page }}">
{{ p.menu }}
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}

<ul {{ tree ? 'class="tree"' : '' }}>
{{ _self.nav_loop(pages) }}
</ul>

8 years ago

But I'm using absolute links in menu, like: <li class="nav-item ">

HTML
                    <a class="nav-link" href="/blog">Blog</a>
                </li>
                <li class="nav-item ">
                    <a class="nav-link" href="/forms/contact">Contact</a>
                </li>
8 years ago

Alright. Just update the links like so -

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

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 13 hours ago
5 60 8 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