1

I have an issue regarding two (that I’ve come across) routes just simply loading the index template when they shouldn’t.

My template structure looked like this:

- search
 - index.twig
- index.twig

When I visited /search the root /index.twig template (front page) loads up.

If I create search.twig next to /index.twig and again go to /search I still get the home template rendered. Removing all search templates and going to /search again, still renders the index.twig template.

There is nothing in config/routes.php and there are also no routes present in craft_routes within the database.

I may have had these routes set up at some point in the past (the project is a bit old), so I created a new database and installed Craft again (kept all other template files, replaced craft/app folder) and the problem went away. Switched database in config (kept new craft/app folder) and now the problem is back again.

Is there anything in the database somewhere that would cause old routes to persist or be funky when the templates and any config/routes.php have been deleted?

I did try and look through the tables but couldn’t really spot anything that stood out, any help would be awesome!

7
  • 1
    I just tried the same setup on my local machine and didn't have any problem loading the correct templates. Do you have any sections called 'search' that may be conflicting? Commented Sep 24, 2015 at 15:02
  • Maybe some weird APC/Opcache/Varnish caching going on?
    – Brad Bell
    Commented Sep 24, 2015 at 18:09
  • @AaronBerkowitz its strange there don't seem to be any conflicting sections, it feels like its at a database level because its resolved as soon as I switch to a new database in config/db.php ... @BradBell I'm running on MAMP Pro and caching is turned off :/ I also manually emptied out storage/runtime\compiled_templates and cleared the cache. No plugins are installed either Commented Sep 24, 2015 at 18:17
  • @AlecRitson If you would like, bundle up your templates and a database export and send to [email protected] so we take a closer look! Commented Sep 24, 2015 at 22:14
  • Hey @AaronBerkowitz I've sent a request through the control panel, I will update this question with any progress. Thanks for you time! Commented Sep 25, 2015 at 12:50

1 Answer 1

1

Thanks to P&T via a support ticket, this issue has been resolved.

Basically I just had a structure which, some point, I had used as my navigation and was causing a conflict. Something which I just completely overlooked.

From P&T via a support ticket:

The issue seems to be in your Navigation structure. You have "Entries in this section have their own URLs" turned on, but you do not set a template for the section. So, when a user requests 'search', which is an entry in your Navigation structure, Craft defaults to show the index.twig template.

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.