url-routing

Is this ARR warning causing my 404?

无人久伴 提交于 2019-12-06 13:43:49
I'm getting a 404 during a URL redirect/rewrite, and I'm unable to pin down exactly what's causing it. The warning is: REWRITE_DISABLED_KERNEL_CACHE Here are my rules: <rule name="TFS Redirect" stopProcessing="true"> <match url="^((?!tfs).)*$" /> <conditions> <add input="{HTTP_HOST}" pattern="tfs.domain.com" /> </conditions> <action type="Redirect" url="http://tfs.domain.com/tfs" /> </rule> <rule name="TFS Rewrite" stopProcessing="true"> <match url="^tfs(.*)" /> <action type="Rewrite" url="http://server3:8080/{R:0}" /> </rule> The redirect rule seems to be working, as I get tfs.domain.com/tfs

MVC 3 Routing and Action Links not following expected contextual Route

寵の児 提交于 2019-12-06 13:31:44
I'm attempting to do a custom route so I can prefix a url in my application with a chosen string and the do some processing based on that. The problem I'm running into is, that the action links that are generated are not contextualized based on the url that it exists on. Routes: routes.MapRoute( "TestRoute", "TEST/{controller}/{action}/{id}", new { controller = "Space", action = "Index", id = UrlParameter.Optional }); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Space", action = "Index", id = UrlParameter.Optional }); Navigating to TEST/Space/Index works, as

mvc.net routing: routevalues in maproutes

对着背影说爱祢 提交于 2019-12-06 13:16:56
问题 I need urls like /controller/verb/noun/id and my action methods would be verb+noun. For example I want /home/edit/team/3 to hit the action method public ActionResult editteam(int id){} I have following route in my global.asax file. routes.MapRoute( "test", "{controller}.mvc/{verb}/{noun}/{id}", new { docid = "", action = "{verb}"+"{noun}", id = "" } ); URLs correctly match the route but I don't know where should I construct the action parameter that is name of action method being called. 回答1:

How to Use Rails 3 Routes with Dynamic Segments

隐身守侯 提交于 2019-12-06 12:55:33
In my Rails 3.2 application, there is an Exercise model with attributes muscle_group and grade_level. I've defined the following route with dynamic segments for it in config/routes.rb: # config/routes.rb match "/:muscle_group/grade-:grade_level/:id" => "exercises#show" Running bundle exec rake routes confirms that the route does indeed exist: /:muscle_group/grade-:grade_level/:id(.:format) exercises#show The database contains an Exercise record with: id = 5 muscle_group = "abdominal" grade_level = 1 And yet when I point my browser to http://localhost:3000/abdominal/grade-1/5 , I get: Routing

Routing URL Path with PHP and Apache

老子叫甜甜 提交于 2019-12-06 08:56:46
问题 I am trying to create a nice url structure for my site. My router class will only work if the url is in the style of ?something=value. How do I get it so it will work like: /something/value In my .htaccess I have: Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !\.(js|txt|gif|jpg|png)$ index.php?$1 [L,QSA] And in my router class I'm making: class init { function __construct() { $URL = substr($_SERVER['REQUEST_URI'],

Passing PHP arguments into NetBeans into a page that features symfony url-routing

只愿长相守 提交于 2019-12-06 08:33:52
问题 I am doing the Jobeet tutorial that features url routing. The url routing (I think that's the proper term) makes urls look like this http://localhost:8080/frontend_dev.php/job/extreme-sensio/paris-france/2/web-designer I would like to debug into this page however I cannot properly pass arguments into NetBeans. I set the arguments in NetBeans "Run Configuration" area to this job/extreme-sensio/paris-france/2/web-designer however the url that is executed is this (notice the ? that NetBeans

Backbone.js and regex routing

不羁的心 提交于 2019-12-06 07:35:05
问题 Is it possible to register a route for /pages/*url but not for /pages/*url/edit/ where URL can be something like this foo/bar/and-so-on ? 回答1: router.route supports using a regex natively. initialize: function(options) { // Matches /117-a/b/c/open, passing "117-a/b/c" to this.open this.route(/^(.*?)\/open$/, "open"); }, open: function(id) { ... } 来源: https://stackoverflow.com/questions/10270840/backbone-js-and-regex-routing

Is it possible to make the default parameter values for routes dynamic in symfony2?

不问归期 提交于 2019-12-06 07:30:14
问题 I have a route defined in a symfony2 controller using annotations. EG: @Route("/{year}", name="show_list_for_user", defaults={ "year" = "2012" }) Is it possible to make make the default year dynamic. Maybe to read the year from a service object? 回答1: I'm afraid that is not possible, the defaults are static. 回答2: You can set default parameters in RequestContext. When Symfony generates an URL, it uses values in this order: See Symfony\Component\Routing\Generator\UrlGenerator::doGenerate :

Rails 4 not changing post method to patch

丶灬走出姿态 提交于 2019-12-06 07:15:31
I am trying to submit a form, but if I just put form_for @classroom I get a "No route matches [POST]" error. Now with the code posted below, I get the wrong url in the form. If I change the url manually in the browser it goes through, and I guess I could do that via javascript, but... why... is... this... happening..? Until yesterday everything was working fine. I even tried rolling back to the things I changed but I can't seem to track what is going wrong. routes.rb patch 'classrooms/:id/update' => "classrooms#update", as: :update_classroom resources :classrooms, except: :update form from

Automatically add parent model id in nested resources

孤人 提交于 2019-12-06 07:12:29
问题 With nested resource routes in Rails 3, such as the following: resources :magazines do resources :ads end helpers such as magazine_ad_path are defined, to which I have to pass both a magazine and the ad, which is inconvenient if I just have a reference to the ad: magazine_ad_path(@ad.magazine, @ad) Is there a nice way to set up an ad_path helper that takes the @ad and returns the appropriate address including the magazine ID? (This would also then allow the use of link_to @ad , redirect_to