I have problem with route action have parameters.
this is my Web route :
Route::get('/services/[id]/[title]', 'SiteController#services');
and this is my blade link :
More
But when i click on this link i have this url :
http://localhost:8000/services/%5Bid%5D/%5Btitle%5D?id=4&title=4
and in wamp i cant see my pages , i have db not found error. but in localhost800 not problem :| help me please thansk all
First, your route variables should be with {} not []. So it should look like this;
Route::get('/services/{id}/{title}', 'SiteController#services');
Then check if you can actually get to that route by manually going to "/services/4/4".
try like this
More
Related
In the prismic docs the default setup they teach means that your homepage and every other page on your site is the same type.
This means that in that default setup the routes / and /home both render the homepage.
Is there a way to prevent the /home route from rendering, or at least redirect it to /?
The easiest way to do this is just with a standard redirect, in your next config:
https://nextjs.org/docs/api-reference/next.config.js/redirects
But there are some other ways that might work, too. For instance, you could add a if(params.uid === "home") router.push("/") to pages/[uid].js, to redirect users from /home to /. (I don't think that code snippet would work, but I hope it illustrates the concept.)
Let me know if you want some other ideas, or if you need help with implementation! I'd be happy to put together a proper example if you need :)
Sam
Edit: Another option would be to create a singleton "Homepage" Custom Type in Prismic.
I'm working on a dynamic project which is adding or changing the route urls.
For example:
I want to add sub application route like AppName/{controller}/{action}/{id}
or maybe a language information like {controller}/{action}/{id}/{language}
in this scenario, I can't touch to other routes and I have to override them.
I tried to foreach RouteTable.Routes and there is no editable values for added routes.
Thanks for any help.
I found the solution.
I cast the items in the RouteTable.Routes to Route object :)
I am having tourble creating and routing static pages from within the Sylius CMS.
I have had this working once but now just can not get it to work at all. Creating the content for the page works fine but when I try to save a route all I get is errors.
An exception has been thrown during the rendering of a template
("Parameter "id" for route "sylius_backend_static_content_update" must
match ".+" ("" given) to generate a corresponding URL.") in
SyliusWebBundle:Backend/Content/StaticContent:update.html.twig at line
20.
Image of the page I am trying to save
Any help would be appreciated as there doesn't seem to be any documentation on this part of sylius.
May be you can have a look into the link below. I also had some problems with the routes while creating the pages. I had solved it by adding some info into the database. Hope this link helps you.
https://github.com/Sylius/Sylius-Standard/issues/78
Happy Syliusing ^^
I am using UrlRewriteFilter to make my URLs pretty. From within my application I frequently need to access the current URL. I do it like this:
ServletActionContext.getRequest().getRequestURI();
However this gives me the ugly version of the URL. How can I access the pretty URL before it is turned into ugly one by UrlRewriteFilter?
You can extend the URLRewriteFilter class and override the doFilter method to store the request path in request attribute (Use this attribute to access the pretty url). Later call the super.doFilter method to let URLRewriteFilter do its job.
I have found this solution here.
This worked for me:
ServletActionContext.getRequest().getAttribute(
"javax.servlet.forward.request_uri");
I have enabled the built in taxonomy/term/% view
I have created a display with path /taxonomy/term/%/test
I also have a URL alias setup on the taxonomy/term path to be /fruits/apple
So I would expect this to work /fruits/apple/test would display my view.
When I browse to this path I get Page not found.
If I browse to the un-aliased path ie /taxonomy/term/156/test it works.
Should the alias work like this?
Ive tried every combination I can think of. Reenabled the view, created new displays, removed all other displays etc
Try this: Path redirect. If itsn't help, rewrite engine help to you.
Try sub-pathauto module.
This module extends that behavior by also matching known sub-paths and
replacing them with their respective alias.
For example, if user/1 is aliased to users/admin, this module rewrites
the link to the user contact page user/1/contact to use the aliased
URL users/admin/contact instead.