Questions tagged [routing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 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 ...
2
votes
1answer
41 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 ...
0
votes
0answers
36 views

Can't redirect cpTrigger and api routes/urls - oauth in craftcms

I have OAuth 2.0 installed in my Craft project. I built an event that every URL is redirected to example.com/oauth and needs authorization if not logged in. Everything works except these two routes: /...
1
vote
1answer
30 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 ...
0
votes
0answers
214 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 ...
2
votes
1answer
756 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 ...
1
vote
1answer
301 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 ...
1
vote
1answer
63 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 /...
1
vote
1answer
322 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 ...
0
votes
0answers
115 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 ...
2
votes
1answer
170 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?
0
votes
0answers
224 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 ...
1
vote
1answer
273 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 ...
1
vote
0answers
27 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 ...
1
vote
1answer
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?
2
votes
1answer
309 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: ...
1
vote
1answer
48 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 ...
1
vote
1answer
324 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 ...
1
vote
1answer
169 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....
1
vote
1answer
234 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" ...
2
votes
1answer
92 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 {...
2
votes
1answer
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 ...
0
votes
1answer
525 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://...
2
votes
1answer
365 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->...
1
vote
0answers
28 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 ...
1
vote
2answers
401 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-...
1
vote
1answer
658 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=/...
1
vote
1answer
2k 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 ...
1
vote
2answers
172 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 ...
1
vote
2answers
295 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 ...
4
votes
1answer
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 ...
1
vote
2answers
129 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 ...
1
vote
1answer
203 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/...
1
vote
0answers
682 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 ...
1
vote
1answer
45 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 ...
1
vote
1answer
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 ...
1
vote
0answers
121 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 ...
4
votes
2answers
714 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 ...
3
votes
3answers
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 ...
3
votes
2answers
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://...
1
vote
1answer
213 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/...
2
votes
1answer
522 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 ...
1
vote
2answers
133 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 ...
1
vote
1answer
147 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' =&...
1
vote
1answer
227 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 ...
3
votes
1answer
669 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 ...
1
vote
1answer
303 views

POSTing data into Craft

I have a site set up that uses Craft as a CMS only, not used to display templates, as this is handled by React JS separately. My site is set up so that Craft responds on /api. I cannot for the life ...
0
votes
1answer
614 views

Can't get correct template for ajax call

Background: I've inherited a site built in craft that has a page called "updates" with a button to load additional entries through ajax. The updates page is an entry in the "page" structure and when ...
2
votes
1answer
1k views

Redirecting “if entry is not defined” returns 404 instead

All the documentation, and answers here say this should work... But it returns the 404 instead of redirecting and I can't figure out why? Section: Structure = help Entry URL Format: Top-Level ...
1
vote
1answer
59 views

Using the same title

I have an article called Main Article and I am rolling out the chapters each week (8x). So, each chapter will have the MAIN Article Title AND Chapter Title. eg: Stories from the top of the World; The ...