We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [routing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
31 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
17 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
33 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
73 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
41 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
40 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
38 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
133 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
48 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
801 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
200 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
247 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
22 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
234 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
339 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
1k 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
154 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
127 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 ...
3
votes
1answer
2k 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
112 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
175 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
479 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
42 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
97 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
495 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
864 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
173 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
412 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
112 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
107 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
170 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
573 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
201 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
523 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
926 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
57 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 ...
0
votes
1answer
194 views

How to setup custom site routes created by user in plugin settings

In my plugin settings I am allowing the user to specify url formats for each locale along with desired template path, much like sections. How do I then register those custom url formats as site ...
1
vote
0answers
97 views

Where to find info on Entry URL Formats and routing syntax/options?

Is there any documentation other than on the CraftCMS web site with details and examples of Entry URL Format options/syntax? I came across an example from Brandon Kelly in this thread yesterday which ...
2
votes
1answer
309 views

Best solution for articles tag page?

I've been looking through the forum, it seems there's a few methods to retrieve a tags page but I'm looking for the most efficient method (both speed- and template-wise). Using tag.name with tag ...
3
votes
1answer
650 views

How to load a different template for parent page

So, I'm newer to Craft, and so I need to figure out the best way to set up a portfolio page with child entries. I've set up a structure, but I need the parent page to load a different template than ...
2
votes
1answer
111 views

Sprout Forms — How to link to individual entries on the front-end

I'm trying to build a front end to display entries collected through Sprout Forms. I want to create a list of all entry titles that can be clicked through to see the full entry. I can list a single ...
1
vote
1answer
68 views

Top level entry url not rendering category in url

I have a structure section called products. The entry url format is products{category.productCategory.first().slug}/{slug} However the category never shows in the preview or real world url (real ...
1
vote
1answer
182 views

Do dynamic routes depend on url rewriting?

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: From what I gather, this should match just about anything... mysite....
0
votes
2answers
282 views

How do I wire my form action to my controller action?

I'm writing my first Craft CMS plugin. I have the following tag in my form: <input type="hidden" name="action" value="clientnameDonation/donateForm/donate"> And then I have the following ...
1
vote
1answer
652 views

Custom URL based on Categories

I am very new to this CMS and I was able to set it up, import some content from csv files. I have set up templates and right now if someone clicks on the article, the URL is www.example.com/articles/{...
1
vote
2answers
1k views

Craft Routing / Variables with Differing URI

I have a project which I'm working on which is going to need something similar to the following URL Structure : site.com/dfe45c4f/news_title, site.com/gyb66dx/news_title or site.com/76vvg3s/...
3
votes
1answer
138 views

ElementAPI endpoint routing syntax for multi-level structure

Would like to be able to handle requests for structured requests so that it may be handled in one endpoint about.json about/the-team.json about/contact/london.json Presumably a form of ...
1
vote
1answer
83 views

Creating HTML and Text version of entry via different templates

So I'm using Craft to create code to be pasted into a blast email program. My standard template is at the following: newsletter/_entry However, I'm having trouble getting the text version to display ...