Questions tagged [routes]

Questions about how Craft handles a request.

164 questions
7
votes
1 answer

Is it possible to tell Craft to ignore requests to under a certain path?

Unfortunately, I'm in a position where I need to run a Craft and WordPress installation out of the same directory. The WordPress install is under the sub-directory /blog. When I visit http://mysite.dev/blog/ the WordPress blog loads as expected, but…
cmal
  • 815
  • 4
  • 14
3
votes
1 answer

How do I toggle list/grid view on section index page without affect category filtering

I have a section "projects" with entry type (projectPage) with and an index page set up displaying a grid view of entries. I have also set up category filtering via links to the {{category.url}} which point to the projects/index template. I want…
2
votes
2 answers

Wildcard subdomain for posts

I want to assign a wildcard domain to every entry from a specific type. For instance: client.example.com Where client is the slug of an entry. Is that possible? If yes, how? Thanks!
Jim
  • 21
  • 2
2
votes
1 answer

Craft routing with extra attributes

I am Craft newbie, and am trying to use PayPal express checkout but am stuck on a confirmation route. How do I register a route like this: localhost:8888/app/confirm?token=EC-5UA33446UB5625646&PayerID=8RB74GZ8ASWGQ What I have done so…
2
votes
2 answers

How do I create an advanced route with an ID that hits a controller method

I am trying to create a page I can hit to update a record in the db, something I am used to doing in Laravel, but now have to do in Craft. The controller method would look something like this: public function updateUserRecordsTest($userId) { …
Rockwell Rice
  • 509
  • 1
  • 5
  • 16
1
vote
1 answer

Catch all routes

I'm porting a site from EE and I'm running into an issue with an existing URL structure not working using routes. Existing URL Structure: /articles/[year]/[month]/[day]/ I tried creating a route for the above to the articles/index template but it…
Alex Rubin
  • 85
  • 2
  • 6
1
vote
0 answers

Route with unspecified number of segments

I have entry which has route like this: category1/category2/.../entry-slug There can be an unspecified number of categories - these are multilevel structure entries. I want to add an entry edit page on the frontend. This page would have URL like…
Piotr Pogorzelski
  • 1,286
  • 7
  • 18
1
vote
1 answer

Custom route with optional tokens

I have a question about custom routes set in routes.php. Can route segment be optional? Taking example from docs - 'blog/archive/' => 'controller/action/path', can we make year token optional in url and still match route when someone…
Piotr Pogorzelski
  • 1,286
  • 7
  • 18
1
vote
1 answer

Filtering routes

I'm using following code to route urls to specific template '-nutrition' => ['template' => '_nutrition/restaurant'], is there a way to limit slug results to specific channel otherwise I can add anything before -nutrition and…
Mark H.
  • 391
  • 2
  • 15
1
vote
2 answers

When using Settings -> Routes in the CMS with wildcard, routes.php does not work

Not sure of this is intentional or a bug but, when we add a route using Settings -> Routes in the CMS, routes.php does not work. I guess maybe its due to us using a wildcard and this takes presedence over routes.php The route we needed to add in the…
Laurence Cope
  • 512
  • 3
  • 12
1
vote
1 answer

Resolving the $entry variable for custom routes somewhere but a Twig template

I have several custom routes defined on the routes.php and, as usual, I am resolving the value of the template's entry in the Twig template when it is not defined (which is when it doesn't match a Craft Route) but I'd like to do it somewhere else…
Rosana Ruiz
  • 523
  • 4
  • 15
1
vote
1 answer

Removing _home_ from Home Page link

I have a single page selected as home page by ticking "This is for homepage" but now I find link comes up as http://example.com/index.php/__home__ I want the home link to only be http://example.com/index.php/ What do I need to do to get rid of…
1
vote
1 answer

Craft 3 multi-site route to template (no entry)

I have a Craft 3 multi-site site - / for the main site, /site1/ for site1, etc. I have a template templates/foo.twig, and /foo hits it for the main site, but /site1/foo does not hit it for site1. I think it should. What am I doing wrong? I am trying…
Marion Newlevant
  • 12,047
  • 22
  • 55
1
vote
1 answer

Setting up routes for AMP template with category-based urls

I'm stuck on implementing AMP templates with category-based URLs as I can't find a way to route the different entry types in the Routes function in the CP. I have a channel title Articles that has two entry types (Lists and Articles) with a URL…
Scott Carr
  • 13
  • 2
1
vote
2 answers

Routing generic urls to sections or structures urls

I have a structure setup with parents and children. Can a route be setup in the CP to route a generic url to a specific parent or child of the structure. For example I have a blog landing page that is a child of the structure. Can a route be…
a-am
  • 2,857
  • 1
  • 19
  • 25
1
2