Questions tagged [routing]
The routing tag has no usage guidance.
124
questions
0
votes
1
answer
33
views
Add chosen location in URL and show content accordingly
We're building a website for a company with multiple locations which need different content but based on the same templates.
I currently have a section Locations.
What I want to achieve is to ...
1
vote
1
answer
42
views
Redirect from /products/.* to /products not working
Currently we have a route called /products. On this route there is a SPA active which handles the routes after /products. To ensure that people don't get a 404 when directly typing in a route like /...
1
vote
1
answer
35
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 ...
3
votes
1
answer
620
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 ...
1
vote
1
answer
45
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
...
1
vote
0
answers
73
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 ...
3
votes
3
answers
237
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/...
0
votes
0
answers
24
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
1
answer
153
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 ...
1
vote
1
answer
150
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
0
answers
779
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
1
answer
2k
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
1
answer
864
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
1
answer
146
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
1
answer
573
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
0
answers
323
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
1
answer
312
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
0
answers
450
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
1
answer
375
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
0
answers
43
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
1
answer
46
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
1
answer
458
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
1
answer
63
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
1
answer
505
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
1
answer
207
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
1
answer
302
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
1
answer
142
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 {...
3
votes
1
answer
4k
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
1
answer
729
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
1
answer
436
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
0
answers
32
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
2
answers
549
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
1
answer
940
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=/...
2
votes
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 ...
1
vote
2
answers
207
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
2
answers
462
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 ...
5
votes
1
answer
4k
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
2
answers
132
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
1
answer
217
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
0
answers
842
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
1
answer
51
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
1
answer
3k
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
0
answers
140
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
2
answers
924
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
3
answers
2k
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
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://...
1
vote
1
answer
231
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
1
answer
598
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
2
answers
151
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
1
answer
211
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' =&...