Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [routing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
24 views

Is there a way to trigger a user account creation from a different CMS?

I'm a junior web developer working with Craft CMS. I was wondering if there was a way to trigger a controller I have for my Craft CMS from an outside CMS. We have more than one website that offers ...
user avatar
3 votes
1 answer
112 views

"Template not found" error when attempting to access static web page

I'm pretty new to craft and I inherited a site that hosts a map from MapBox as a static html file in the /web folder, so something like /web/map/old-map/index.html. Hitting mysite.org/map/old-map ...
user avatar
  • 193
1 vote
1 answer
19 views

Set a default Channel page if no slug is provided in the URL

I was wondering if there was a way to set a channels page as the default page to load if there is no slug address i.e. I want the below web address to default to a skills page myWebsite.com/skills ...
user avatar
  • 275
1 vote
0 answers
35 views

Maintaining the same page creating experience in a headless Craft CMS configuration - Next.js

I don't see a clear path to get the full page creating experience in any headless configuration as is available in Craft/Twig. The routing in next.js specifically I think is the main obstacle. Next.js ...
user avatar
  • 21
1 vote
2 answers
69 views

Craft's case-insensitive routing

I was just surprised when I noticed, that our Craft installation is not case sensitive with routing: E.g. https://domain.com/route/to/page-with-content delivers the same content as https://domain.com/...
user avatar
0 votes
0 answers
23 views

Cannot find page but is active in the admin panel. Staging and locally no issues

I've recently deployed an extension to an already existing craft website. I always have a staging website where we can make sure everything is working as expected. Everything was. When I pushed the ...
user avatar
2 votes
1 answer
63 views

Dynamic URI to load entry template

This may be asking the impossible, but I'm trying to do the following: Say I have 3 channels, Country, Region, and Town. Town has an entry field to select a Region, a Region entry has a field to ...
user avatar
  • 95
1 vote
1 answer
43 views

Dynamic URL generated by a custom field dropdown value

I have a special case where the URL needs to be defined from within the entry itself. I have a dropdown that I want to populate with the URLs as values. Can the dropdown value be used to generate the ...
user avatar
  • 25
0 votes
0 answers
422 views

Path to asset file shows "Template not found!"

I have a headless Craft CMS site and now the frontend development should start. I have absolutely no frontend or templates as I only worked on the backend. The asset url got created at /images. If for ...
user avatar
  • 21
2 votes
1 answer
1k views

CORS preflight check failing for AJAX login form on different domain

I've built an AJAX frontend login form, using plain Javascript. It works fine until I try and access it from a different domain. The problem is CORS and the preflight request. The preflight request ...
user avatar
1 vote
1 answer
540 views

Register custom REST routes while building a plugin for Craft 3

I am building a custom plugin for Craft and I am hitting some REST APIs in my backend service to fetch some data using Ajax calls in JS. What I would like to do when the AJAX calls complete and come ...
user avatar
  • 217
1 vote
1 answer
97 views

Routing: ignoring a segment from the URL

I am trying to configure my routes so that the last segment of the URL is ignored and can be used as parameter in the twig file. for example, the following URL should ignore the city-segment /...
user avatar
  • 25
1 vote
1 answer
397 views

{% Exit 404 %} doesn't work right with routes

The {% exit 404 %} doesn't work right on routed templates. It's fine on pages that aren't affected by routes. Mysite.com/asdfasdf shows me the proper 404 page. I've got some routes configured like ...
user avatar
  • 482
0 votes
0 answers
157 views

How can i get the current applied route in CraftCMS?

I'm using a dynamic route that loads a template. I'm on a multisite setup with a language switch in the header menu. To be able to switch between sites or languages, the dynamic routes need to have ...
user avatar
  • 101
2 votes
1 answer
221 views

How to route 404 errors for multi-site Craft?

Craft looks for /templates/404 by default. What do you do if you have multiple sites?
user avatar
  • 684
0 votes
0 answers
299 views

404 shows "Internal Server Error" only on staging environment

Might be a duplicate, but couldn't find this exact question here. I have a pretty basic 404.twig template that should be catching things, as described here: https://docs.craftcms.com/v3/routing.html ...
user avatar
  • 73
1 vote
1 answer
315 views

Plugin RegisterUrlRulesEvent - Regex URL-Routing gives 404

I'm updating a Craft 2 plugin to Craft 3 and I'm having difficulties getting the Regex URLs working correctly. The eocs I'm using: Craft3 Docs I used pluginfactory.io to create the basic craft3 ...
user avatar
  • 313
1 vote
0 answers
36 views

Override the language-part in URL and add a region (en-fr / fr-fr)

I ran into a problem one year ago, but our we changed the specifications and so it was not neccessary anymore(another question here commented). One year later now, the issue is back, harder as before ...
user avatar
  • 85
1 vote
1 answer
44 views

URL routing with types

We need to setup following URL: DOMAIN/{lang}/{family}/offers/{slug} e.g.: example.com/en/Larsen/offers/example What do we need to configure our section URL? Have anyone an idea?
user avatar
  • 11
2 votes
1 answer
414 views

How to create an advanced route with query strings?

I have a main structure as my navigation. Within this structure I have multiple image galleries. I want to make the image gallery's urls dynamic. If I define a gallery within the structure entry: ...
user avatar
  • 555
1 vote
1 answer
53 views

Migrating custom routes from v2 to v3

I have a handful of custom routes configured on this project like 'action/(?P<custom_id>[a-zA-Z][0-9]{6})/(?P<slug>.*)' => 'action/_member', If I'm reading the docs correctly, then ...
user avatar
  • 1,733
1 vote
1 answer
398 views

Routing: How can I ignore a parameter in route definition?

I'm trying to route users to a "locations" structure entry that normally has a URL structure that looks like: locations/<slug> My client wants to use the structure of links from their old site ...
user avatar
  • 73
1 vote
1 answer
197 views

Route directly to an S3-hosted asset?

I have a multi-site Craft install. I'd like to offer the ability for each site to upload an icon that will be used for favicons. I noticed a lot of 404s for both /favicon.ico and /apple-touch-icon....
user avatar
1 vote
1 answer
259 views

Variable "entrySlug" does not exist Routing

I currently have a routing set up as follows to enable an "Edit" entry page following on from this question but I'm getting the following error message when going to that page. Variable "entrySlug" ...
user avatar
  • 1,218
2 votes
1 answer
116 views

Second Site Channel URL Route Not Working

I've set up a Resources section on a multi-site installation with the type of Channel. For Site 1 I've set the routing rule to be {resourcesParent.one.slug}/{slug} and for Site 2 I've set the rule as {...
user avatar
  • 1,075
2 votes
1 answer
3k views

Asset (image) public URL does not work

I wanted to include some uploaded assets (images) in an entry. The .url property in twig outputs the proper URL, in my case: http://localhost/craftcms/web/image/photo-2017-04-02-16-20-53-1.jpg ...
user avatar
0 votes
1 answer
608 views

Removing "action" from a module's route. Is it possible?

I have a module with a route that looks like this: http://localhost/actions/module/controller/action Is it possible to set up a custom route within my module so I can send people to: http://...
user avatar
2 votes
1 answer
396 views

Make segment in the middle of a route optional

In the following route configuration i want to make the height segment optional. So that /images/400/200/placeholder.png /images/400/placeholder.png are both possible with one route. $event->...
user avatar
  • 359
1 vote
0 answers
30 views

Route manipulating - set regioncode before language-code

I just finished the structure of a new site, now I am faced with the problem: "regions". I thought I can use categories for routing. Because I need: example.com/REGION/LANGUAGE/about-us or ...
user avatar
  • 85
1 vote
2 answers
454 views

Why is the parent slug showing up in the child slug in a structure?

Basic info I have a structure with a handle about. The Entry URI format is about/{slug}. EDIT: also tried it with just {{ slug }} I created a child page called "Privacy Policy" with the slug privacy-...
user avatar
1 vote
1 answer
749 views

Nginx config for craft working for everything but admin url's

I am trying to configure NGINX to serve a craft 2 site. I am getting the requests being routed through index.php for template url's but not for any admin routes which are redirecting to index.php?p=/...
user avatar
  • 179
1 vote
1 answer
3k views

Entry URL Format

I'm currently trying to get my URL's to be like the following: category/brand/offer/ Category has a title Brand has a 'shortName' property. Offer has a title My plan is to have it so that it goes ...
user avatar
  • 1,218
1 vote
2 answers
195 views

Can you use Routes on Structure entries

I'm using a route to use a different template, but whatever I try the page remains unchanged, my structure is set as: entry url format: {slug} entry template: _pages/_entry I want an entry's slug ...
user avatar
  • 447
1 vote
2 answers
347 views

How to point a static url to a file

I have a field "menu card" in my globals' section "menuCard", so I could access my file in the template with menuCard.menuCard.first().url. That is fine, but when the editor changes the menu-card file ...
user avatar
  • 137
5 votes
1 answer
3k views

How to route to a controller action in Craft3?

Before I get tagged as a duplicate I have already tried everything in the 'duplicate' issues on here to no avail so I'm posting my exact config to see what I'm doing wrong. Here is my plugin code and ...
user avatar
1 vote
2 answers
131 views

Secondary Template for Structure

I created a Profile structure for my client's employees. He asked if I could generate an email signature for them from their Profile. I figured out a way to put all the signatures on one page using a ...
user avatar
1 vote
1 answer
205 views

Specify which template/layout to use based on URI segment

I have 3 level structure for my entries with separate template for each level. /artists/artist-name/ uses artists/_types/artists.html template /artists/artist-name/section-name/ uses artists/_types/...
user avatar
  • 393
1 vote
0 answers
732 views

Custom Routes with URL Parameters and Pagination

I am migrating an old EE site to Craft. The EE site has a filter feature for certain weblogs. It outputs a list of entries for a weblog filtering on year, program, etc... which are passed as URL ...
user avatar
  • 135
1 vote
1 answer
50 views

How do I do routing for something like {city}/pricing, {city}/how-it-works, etc. while loading the same template and dataset?

I'm trying to set up a site for clients that have locations in multiple cities and who want to be able to display something specific to that location on certain pages. I would like to set up routes ...
user avatar
1 vote
1 answer
2k views

Page not found error

After setting up a template file article.html in craft/templates folder, and creating the section article with the uri article and setting the entry template as article in the admin, on trying to see ...
user avatar
  • 153
1 vote
0 answers
136 views

Alter the routing in Craft for every URL independent of language

How can I alter the routing in Craft? I need to add a (variable) segment to every possible URL. The reason is we have a multi lingual site with multiple regions. We need to know the correct region in ...
user avatar
  • 1,456
4 votes
2 answers
800 views

Multiple URL's for news entry?

For news entries I want both URL's www.example.com/news/678 (where 678 stands for the entry id) and www.example.com/news/some-slug to load the same entry. www.example.com/news/some-slug works fine ...
user avatar
3 votes
3 answers
1k views

Routing within a single page app integration

I'm using Craft as the backend for an app and VueJS along with Element API to deliver the content. Everything so far is working sweet, except when I try to pull up the detail page for an entry ...
user avatar
  • 1,733
3 votes
2 answers
1k views

Catch-all routes based on template structure

I have many of the templates organized into sub-folders. E.g. /manager/entries/edit.html, /manager/users/edit.html etc. The site is using 4-segment URLs to access code in those templates, e.g. http://...
user avatar
1 vote
1 answer
224 views

Getting only slug in otherwise null object on routed template

I'm trying to create a template route that allows me to get all of the attorneys that I've related to a specified practice area. I can get the slug easily, as my route looks like this: 'attorneys/...
user avatar
2 votes
1 answer
549 views

CraftCMS with Cloudfront Full Page Delivery

I have a fully static website. All images and videos are currently delivered via aws cloudfront. Now I am thinking of delivering the HTML via cloudfront as well. My concern is that craftCMS routing ...
user avatar
  • 143
1 vote
2 answers
147 views

Trouble with registerCpRoutes()

I'm trying to add some custom routes for my plugin, but it's throwing a 400 CHttpException for invalidActionParams when accessing largeupload/folders/2 as an example. public function registerCpRoutes ...
user avatar
  • 2,947
1 vote
1 answer
179 views

No template found when accessing action method per route

I want to render a (non-CP) template from an action method in my plugin controller over a route I defined in the plugin base class: function registerSiteRoutes() { return array( 'myservice' =&...
user avatar
  • 121
1 vote
1 answer
240 views

Running Craft from two subdirectories

We are trying to add Craft alongside another CMS. I currently have Craft setup with the Craft app directory above web root and then two web accessible sub-directories as follows: blog offer Each ...
user avatar
  • 699
3 votes
1 answer
690 views

How to do advanced routing to a Craft channel

For a project I have, I am unable to use the standard Craft routing for a channel. For example, /events/{slug} <- this is how Craft wants to do it /{slug} <- this is how the client ...
user avatar