Skip to main content

Questions tagged [routes]

Questions about how Craft handles a request.

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

Use different template for same route based on user group

I'd like to have consistent URL's for an account section but depending on the current users group, the template will be different. I know I could use the same template but there would be a lot of if/...
Luke Pearce's user avatar
  • 3,863
1 vote
1 answer
316 views

Loading entry based on dynamic route

I'm trying to load an entry based on the following url: /artists/nameOfArtist/nameOfCategory/myEntry/thumb This URL follows the structure of my entries: Artist > Category > Entry So, I'm thinking ...
SoHo's user avatar
  • 403
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/...
SoHo's user avatar
  • 403
1 vote
1 answer
369 views

How to get a proper tag Url

I use the code "Link to the Tag URLs" from the following article: https://craftcms.com/support/tag-urls {% if entry.tags | length %} <h3>This entry is tagged with:</h3> <ul> {% ...
Jan's user avatar
  • 196
1 vote
1 answer
323 views

Custom routes using kebab {type} in URL segment

I have a section that has multiple entry types. I would like to use kebab-style url segments in the URL format. I can get the articles to serve kebab URIs using this for the section's Entry URL Format:...
Shanan Galligan's user avatar
3 votes
1 answer
972 views

How do you handle routes in CP with Query Parameters?

I am currently setting up routes for a one-page application. As soon as a Query Parameter is introduced, the route fails. The route "test" replaces "my-av1" in the following photos. The documentation ...
Kristian S. Munkvold's user avatar
1 vote
1 answer
133 views

Search going to /index.php?q= instead of results

I've pushed my site to Digital Ocean from Localhost, the site is all up and running - URL's are all working. But when I try and search the site it seems to be heading to http://123.456.789/index....
JMKelley's user avatar
  • 1,416
1 vote
0 answers
143 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 ...
Tom De Smet's user avatar
  • 1,456
0 votes
1 answer
520 views

How can I have a dynamic uri segment for a single?

I am trying to have a dynamic uri segment for a single. I have this uri in the CP settings: offers/listing/{slug} Where {slug} is the entryId. For example, offers/listing/1234 I have a template ...
Damon's user avatar
  • 4,706
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 ...
Steven Grant's user avatar
  • 1,855
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://...
Yuri Salimovskiy's user avatar
0 votes
1 answer
193 views

How do I set a controller for my homepage

How can I set a controller for the homepage? I can't seem to find any way to override the default route to the homepage. I need to call an action from the homepage and can't find any examples of this ...
Robert's user avatar
  • 1
1 vote
1 answer
369 views

Dynamic entry template not loading on staging site but works on local.dev

I'm having a strange issue where pages aren't loading on the staging site that were all working fine on the local.dev site. I have a Section called Available Homes and in that section it has two ...
mention79's user avatar
  • 543
1 vote
1 answer
239 views

craft()->urlManager->setRouteVariables() loads the correct template but does not pass in the variables

everybody! setRouteVariables() doesn't appear to be working for me. If I boil my controller function down to just this: public function actionSubmitForm() { craft()->urlManager->...
Billy Pilgrim's user avatar
1 vote
1 answer
302 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 ...
Mike's user avatar
  • 719
1 vote
1 answer
121 views

Route to User page from first segment

I am building a site for a travel agency. Each agent needs to have his/her own public profile page. I want each agent's profile page to be accessed at agencyname.com/agentname, with agentname being ...
Philip Jones's user avatar
0 votes
1 answer
657 views

Confused about tags

I'm tried to following the how-to implement tags but can't see to get it to work. The how-to: https://craftcms.com/support/tag-urls I created a new route, and in the URI field, I entered: tags/( ‘...
DevServe's user avatar
  • 303
2 votes
2 answers
355 views

Prettify search URL

I can't find a way to clean up the search address from /search/?q=.../ to /search/query/. I see ways of getting the last segment of the url with something like craft.request.getSegment. My other ...
Kitsune's user avatar
  • 333
1 vote
1 answer
125 views

How can I set up a filter URL like example.com/category/foo/type/bar/country/usa

Given a category based set of entries/products, and a filter system based on tags, how would I accept (one of) the following urls and let one template process them all (not interested in the ...
Paul's user avatar
  • 6,338
1 vote
1 answer
181 views

Possible to use REGEX Backreference in Routes

I've searched and searched for info on regex backreferences in Craft's route.php file to no avail. I have a URL structure required by the client along the lines of: / [state] / [section] / region / ...
Shane Robinson's user avatar
1 vote
2 answers
1k views

URL drops :8888 from localhost

I'm running Craft CMS with MAMP at localhost:8888. When I pass in a URL with {{ entry.title }}, I get http://localhost/news/2016/we-just-installed-craft which gives me a 404 until I manually put in ...
Davers's user avatar
  • 67
1 vote
1 answer
746 views

Use of tag.slug instead of tag.title in a custom route

I've followed this guide for creating a routes to list entries with specific tags. It is working fine except that I have muli-word tags so using the tag token from Settings -> Routes gives me urls ...
Andrew Staroscik's user avatar
1 vote
1 answer
60 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 ...
Nutmeg's user avatar
  • 598
4 votes
1 answer
550 views

Simple template routes with plugins

I'm attempting to create a simple route that points to a template from a plugin. Note that I am attempting to create a page on the front-facing website, not the admin panel. Plugin (named: 'curious') ...
Jason's user avatar
  • 348
1 vote
1 answer
144 views

Can't open new single section

I created a new Single section and named it "test", added some content and tried to view it on domain.com/test. Unfortunately I get my default server 404 and not the new single section. I tried to ...
Smitdh's user avatar
  • 11
0 votes
1 answer
140 views

Single not loading correctly with additional segments

I've got a single set up to point to /calendar on my site. the single has only one field, SEOmatic so I can add meta title, description etc.. the rest of he page is loaded with content from the ...
CreateSean's user avatar
  • 1,983
4 votes
1 answer
570 views

Redirect entry type to another domain

I have an entry type (outsideCourse) that will never need its own page. It only exists so I can manipulate it in various lists of required courses. Thanks to Mats Mikkel Rummelhoff, I have a macro to ...
Katie Fritz's user avatar
0 votes
1 answer
296 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 ...
a-am's user avatar
  • 2,857
2 votes
2 answers
880 views

Multiple URL Formats per element type (Entries, Categories)

I suspect this boils down to a feature request, but I'll start here in case there are any other ideas. Basically, I want to be able to define multiple URL formats for a single section or category ...
Tim Kelty's user avatar
  • 3,081
2 votes
1 answer
470 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 ...
Rob's user avatar
  • 865
5 votes
1 answer
154 views

Is environmental routing possible?

In the general.php config file, I can target settings for multi-environments like so: return array( '*' => array( 'devMode' => false ), '.loc' => array( 'devMode' => true ...
Mark Notton's user avatar
  • 2,337
1 vote
1 answer
143 views

Advanced routing descriptive URLs to certain pages/posts

This is a general SEO question. In Wordpress you can create a page and define the permalink URL. In Craft I want to do something similar. I want to build the backend with a common sense structure, ...
Shealan's user avatar
  • 264
1 vote
3 answers
2k views

Different template for an entry in section

If I have a Section called "Pages" that uses the "page.html" Entry Template. How do I override that template for a single page in this Section? I thought I would be able to use Craft Routing but ...
zuccs's user avatar
  • 23
1 vote
1 answer
92 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 ...
Ben Shoults's user avatar
1 vote
0 answers
97 views

Overriding Craft's default routing process [duplicate]

I have a situation where I'd like to have an entry exist with a particular URL structure by placing it within an existing structure. Let's say this URI is: /one/two/three Where 'three' is the entry ...
Collin Joyce's user avatar
2 votes
1 answer
734 views

How to troubleshoot routes

Very new to Craft CMS... My first route, which i think is very simple, is not working, i'm getting a 404 error. How can I troubleshoot routing? My settings: If the URI looks like this: databases/ ...
Bill French's user avatar
2 votes
1 answer
203 views

Setting up Route for Category-based RSS Feeds

I think that I need to set up a few routes to handle my category based RSS feeds. I have a current url structure as follows http://something.com/shows/wmr/marketing pr http://something.com/...
David A McInnis's user avatar
2 votes
2 answers
912 views

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: ...
Rockwell Rice's user avatar
0 votes
1 answer
206 views

How do I prevent a runPendingTask script being included in returned HTML via ajax? [closed]

I have created a route to retrieve some categories via AJAX. When the AJAX call returns the HTML a runPendingTask script is also returned with the HTML. How do I prevent this? /*<![CDATA[*/ (...
a-am's user avatar
  • 2,857
2 votes
1 answer
533 views

Can I open templates/routes other than 503 when Craft is offline?

I've set Craft offline (System status). Is it possible to "open" URL routes so it can be accessed even though the website is offline? Right now every request gets routed to my 503.html page. For ...
carlcs's user avatar
  • 36.3k
3 votes
2 answers
808 views

Can I open one template/route when Craft is offline?

I've set Craft offline (System status). Is it possible to "open" one specific URL route so it can be accessed even though the website is offline? For example the route: /blog/post
naboovalley's user avatar
  • 2,844
1 vote
0 answers
267 views

How do I use the section Entry URL format for registerSiteRoutes() in a plugin?

I'm trying to register a site route in my plugin based on the Entry URL format for a section chosen in the plugin settings. So if it's the default news section in the Craft install the URL format ...
Derry Lozano-Hoyland's user avatar
2 votes
1 answer
96 views

How do I setup my Element Types Sources for deep linking?

In the Entries tab in the Control Panel, I see a list of Sources on the left hand side: All Entries Singles News When I click on each of these sources the page filters the appropriate results in the ...
Ben Parizek's user avatar
  • 13.5k
0 votes
1 answer
62 views

Bizarre admin menu problem after upgrading craft to latest version [duplicate]

Hi not sure if anyone has come across this issue before? I upgraded craft to the latest version on my test site. I have a few custom plugins that I have created on this site. The front-end seems to be ...
Lettie's user avatar
  • 2,033
2 votes
2 answers
3k views

How can I call a controller method from the front-end using ajax

I would like to call an action method from within my plugin via ajax but I am always getting a 404 response. I have a controller method that matches the ajax url: jquery $.ajax({ 'type': 'post'...
Damon's user avatar
  • 4,706
1 vote
1 answer
850 views

Dynamic route returning 404 error

I've set up some dynamic routes to work with categories, so for example the route is set up to load a specific template if the work category appears in the URI, thus: news-events/image-gallery/...
Cole Henley's user avatar
  • 1,741
2 votes
2 answers
453 views

Passing data back to form on invalid submission

I currently have a form that is being displayed to the user via a custom route. The form submits to a controller. The first thing the controller does is populate a custom model and validates it. If ...
John O's user avatar
  • 391
2 votes
1 answer
1k views

How can I get an entry based on category and slug (via url segments)?

I am using (and have used) this S.O post to create a product filter/search using multiple categories. Everything is working perfectly. I am attempting to use the same type of logic to grab ultimately ...
Damon's user avatar
  • 4,706
4 votes
2 answers
2k views

Controller action redirection when called via route

I have a route set up in routes.php that calls a controller action using something similar to what is described here: https://straightupcraft.com/articles/how-do-i-setup-a-route-to-point-to-a-...
John O's user avatar
  • 391
3 votes
1 answer
476 views

Override a wildcard dynamic route template

I have a dynamic route for individual user /profiles. I expected it would be possible to override this route for /profiles/all but apparently not. This can be achieved in the template I expect, with ...
Rob's user avatar
  • 865