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?

  • Not sure how to answer your question, but check out craftcms.com/support/why-index.php and craftcms.stackexchange.com/questions/961/… – it might nudge you in the right direction. – Mats Mikkel Rummelhoff Jun 29 '16 at 0: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 3: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 4:32
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.

| improve this answer | |

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.