1

My navigation looks like so:

<li><a href="{{ url('http://www.mysite.com/') }}" {% if craft.request.firstSegment == 'home' %}class="active"{% endif %}>Home</a></li>
<li><a href="{{ siteUrl('services') }}" {% if craft.request.firstSegment == 'service' %}class="active"{% endif %}>Services</a></li>

But when I click on "services", I get 404 not found. What I'm trying to understand is where is my URL? I thought it would be something like www.mysite.com/index.php/services.

I have tried laying this out in both public HTML part of my server and the Craft folder.

My folder structure is:

Route/
    css/
    img/
    index.php
    _layout.html
    _services.html; this is the file i need to navigate to

1 Answer 1

1

Your syntax is wrong. You don't need to put "('service')" inside your twig code plus you don't need to enter your siteUrl.

If you fill the href with /services it should work like supposed to.

If you are having trouble with index.php being in your URL you should check this guide out in the docs.

https://craftcms.com/support/remove-index.php

Another thing, You shouldn't put any HTML / Template files inside your public_html folder. They should all be in the craft/templates folder.

More in the docs here: https://craftcms.com/docs/folder-structure

Also make sure you made a entry for the page you want in this case "services".

If you keep finding problems like this you should try the Craft CMS Slack channel. Over 4000 developers joined already and are able to help you in a more direct way.

https://craftcms.com/community#slack

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.