1

I need to set up a custom route for a particular page, but can't seem to get anything to work.

For instance, I set up this route:

busted routes

From what I gather, this should match just about anything... mysite.dev/hello, or mysite.dev/goodbye. But no matter what I try, I get tossed back to my index.

My only theory right now is that the Craft url structure is strange. I navigate around just fine, but there is no rewrite happening. So instead of http://mysite.dev/site-sections/we-work-on, it's http://mysite.dev/index.php?p=site-sections/we-work-on. I think this is because I'm developing on a Homestead box, which uses nginx and not apache.

Do dynamic routes depend on url rewriting?

Erik G
  • 103
  • 4
  • Not sure how to answer your question, but check out https://craftcms.com/support/why-index.php and http://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft – it might nudge you in the right direction. – Mats Mikkel Rummelhoff Jun 29 '16 at 00:49
  • Thanks for the links Mats -- my attempt at editing the nginx config resulted in a rather terrifying "can't even find the index" error, but there was a silver lining: after destroying and recreating my Vagrant the urls mysteriously fixed themselves, and I no longer see querystrings on the index. Custom routes also now work.

    So that's mysterious but I'll take it for now -- my deadline is fast-approaching.

    – Erik G Jun 29 '16 at 03:02
  • @ErikG Weird, but glad you're up and running. Would you mind adding that as an official answer? – Brad Bell Jun 29 '16 at 04:32

1 Answers1

2

I first attempted, with the link Mats posted, to edit my nginx config. That resulted in a rather terrifying "can't even find the index" error, but there was a silver lining: after destroying and recreating my Vagrant the urls mysteriously fixed themselves, and I no longer see querystrings on the index. Custom routes also now work. So that's mysterious but I'll take it for now.

Erik G
  • 103
  • 4