routing

Meteor infinite redirect instead of render 404

纵然是瞬间 提交于 2019-11-28 05:43:00
问题 I have a simple iron-router config in my /lib/router.coffee: Router.configure notFoundTemplate: "notFound" Router.map -> @route "app", path: "/" template: "app" When entering on / it's works, but if I try go to /abc then it redirects me at /#!abc, after that it redirects me at /abc and so repeated endlessly (I see these changes in the address bar of a browser, in the browser log redirection from / to /abc and back). I never see a 404 error. Has anyone encountered such behavior? I use Meteor

ASP.NET 4.0 URL Routing HTTP Error 404.0 - Not Found

柔情痞子 提交于 2019-11-28 05:33:01
I have implemented URL routing in ASP.NET 4.0 using following route. routes.MapPageRoute( "NewsDetails", // Route name "news/{i}/{*n}", // Route URL "~/newsdetails.aspx" // Web page to handle route ); which gives me url like http://www.mysie.com/news/1/this-is-test-news and this is working in my localhost fine. But when I uploaded it on the server it gives ... Server Error 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. If I try http://www.mysie.com/news/1/this-is-test-news.aspx then it displays

ServiceStack Routing does not work with querystring

╄→尐↘猪︶ㄣ 提交于 2019-11-28 05:28:21
I have a simple REST service built with ServiceStack. If I configure the routes like this: //register user-defined REST-ful urls Routes .Add<Contact>("/Contacts") .Add<Contact>("/Contacts/{ContactId}") This request succeeds. http://<server>:59557/Contacts?ContactId=9999 //Works If I configure the routes like this (Business Analyst prefers the generated metadata) //register user-defined REST-ful urls Routes .Add<UpdateContact>("/UpdateContact", "PUT") .Add<CreateContact>("/CreateContact", "POST") .Add<GetContact>("/Contacts/{ContactId}", "GET") http://<server>:59557/Contacts/9999 //Works http:/

Multiple canActivate guards all run when first fails

故事扮演 提交于 2019-11-28 04:58:02
I have a route with two canActivate guards ( AuthGuard and RoleGuard ). The first ( AuthGuard ) checks to see if the user is logged in and, if not, redirects to the login page. The second checks to see if the user has a role defined that is allowed to view the page and, if not, redirects to the un-authorized page. canActivate: [ AuthGuard, RoleGuard ] ... export class AuthGuard implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> { ... this.router.navigate(['/login']); resolve(false); } export class RoleGuard implements CanActivate {

Symfony - Defining a route only in dev. environment

怎甘沉沦 提交于 2019-11-28 04:49:51
问题 I'm using SF2 and I created some routes helping the debugging of the project: widget_debug_page: path: /debug/widget/{widgetName} defaults: { _controller: WidgetBundle:Debug:default } The problem is that this route MUST never be reachable when going in production. I could not find a parameter to specify the environment. 回答1: You can add your route in routing_dev.yml (Symfony 2/3) or create a dev-only routing file in config/routes/dev/ (Symfony 4). 回答2: Just for people who want use with

Django: serving ADMIN media files

↘锁芯ラ 提交于 2019-11-28 04:45:12
I've been successfully serving media files for the normal MEDIA files, but when I tried serving admin media files, I failed. please kindly help me locating the problem, as I've tried to troubleshoot the problem for several hours already with no luck (been googling too and read the django doc about serving static files as well). The error as I tried to access localhost:8000/media/a.gif is as following: Page not found: f:\python25\lib\site-packages\django/contrib/admin/media\a.gif I put the admin media files in directory named "media", while I put the normal media files in directory named

Laravel same route, different controller

你离开我真会死。 提交于 2019-11-28 04:43:47
问题 I would like to have general home page and a different homepage for logged-in users I search a lot on google but I can't find what to put in my if statement I tried something like this: Route::get('/', array('as'=>'home', function(){ if (!Auth::check()) { Route::get('/', array('uses'=>'homecontroller@index')); } else{ Route::get('/', array('uses'=>'usercontroller@home')); } })); I also try with something like: return Controller::call('homecontroller@index'); but it seems it's not for laravel

Laravel slash after url redirects to root folder

只谈情不闲聊 提交于 2019-11-28 04:37:45
问题 I'm new to Laravel and it seems a great framework but i have a question when it comes to routing. I want to route all get requests to one controller action named PageController@view but when the prefix is admin i want it to route to Admin\AdminController@view. I have the following code: Route::get('/{slug?}', 'PageController@view'); Route::group(array('prefix' => 'admin', 'namespace' => 'Admin', 'before' => 'auth'), function() { Route::get('/', 'DashboardController@main'); }); But when i go

Considerations when turning on RouteExistingFiles

喜你入骨 提交于 2019-11-28 04:33:42
问题 I am looking to generate some CSS files dynamically in my Content folder. At the moment, this folder has an ignore route ( routes.IgnoreRoute("Content/{*wildcard}"); ) and, I'd like that to remain, as I don't need/want most of my content folders to go into the MVC request lifecycle. Example: routes.MapRoute( "DynamicCSS", "Content/Css/Dynamic/{guid}.css", new { controller = "Site", action = "GenerateCSS" }, new { guid = @"^([0-9a-fA-F]){8}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a

ASP.NET MVC: Many routes -> always only one controller

此生再无相见时 提交于 2019-11-28 04:31:42
问题 I have very simple question. My site, based on ASP.NET MVC, can have many urls, but all of them should bring to the one controller. How to do that? I suppose I need some magic in Global.asax but I don't know how to create route that will redirect any url to the specific controller. For example I have url /about, /product/id etc. but all of them should be really bring to the content/show where the parts of url will be recognized and the decision what information to show will be make. It's some