0

For some reason there is not really a clear mention on the Craft documentation about this. And I couldn't really find anything in here that explains it either. I know this is kind of basic knowledge for Craft, so here goes:

I made a single section called 'work' and a folder of the same name in my templates folder (with an index.html inside). I try to link to it with http://www.mydomain.com/work/ but it doesn't work! It gives a 404 error. I don't understand why it doesn't work. I don't remember having trouble with this before.

What can possibly go wrong?

How do I create simple links like this to other singles?

1

You made the template filename and folder match the URI (routing case 6), which is not necessary for entries. Because you probably also set a template in the section setting, this is getting loaded for http://example.com/work/ (routing case 4).

So I think you should just edit the single section's settings and point to the right template.

|improve this answer|||||
  • Thanks for your help. I thought the folder structure was necessary for it work, since there already was a folder in my templates called 'news', which was holding the channel section. I think I'm getting somewhere, but example.com/work/ still doesn't work. Right now it -does- work when I go to example.com/index.php/work/, since the URI that I entered now is just 'work'. Somehow there is something with these slashes. – GeirrBenayahu May 26 '15 at 12:39
  • Yes, but there's no single section for "news". It's a channel and the channel entries are routed to /news/_entry.html (see section settings). The template for the channel index page /news/index.html does not have any entry at all (routing case 6). – carlcs May 26 '15 at 12:44
  • @GeirrBenayahu also have a look at this help article: buildwithcraft.com/help/why-index.php – carlcs May 26 '15 at 12:47
  • Okay ehm... So yeah, I first broke Craft for reasons that I cannot really trace back. I think I replaced one of the files with a wrong one. But after fixing it with the correct files I now also need a example.com/index.php/admin kind-of link to go to my admin panel, which before wasn't necessary. I really have no clue what happened and don't know how to fix this... even after reinstalling the folder. Also the above options haven't been able to fix the initial issue. Maybe someone can explain a bit more thoroughly how this works and how the syntax should be? That would be truly awesome. – GeirrBenayahu May 27 '15 at 13:35
  • I mean I understand how it is explained in the help files of Craft and in its documentation. But I just can't figure out what I need to do in order to fix this. I tried so many variations with the URI and URL, but none of it works... :( – GeirrBenayahu May 27 '15 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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