routes

Backbone.js PushState routes .htaccess only working as hash but nowhere else

好久不见. 提交于 2019-12-23 16:49:57
问题 I have a website domain.com for example. I have backbone.js with pushstate and fallback and when I goto domain.com/about it loads up the index.html page and pushstates to about. everything is working. but if i want to goto a directory with a page inside like: www.domain.com/bio/moreinfo for example, it does not work and throws a invalid page. if i do it in IE it works fine. my htaccess file has the following: RewriteEngine on # html5 pushstate (history) support: <ifModule mod_rewrite.c>

Rails 3 routes: How to avoid conflict with 'show' action?

妖精的绣舞 提交于 2019-12-23 16:22:14
问题 I currently have the following routes set up for photos : resources :photos match 'photos/:user' => 'photos#user', :as => :user_photo match 'photos/:user/:key' => 'photos#show', :as => :show_photo Those two match routes give me URLs like: http://example.com/photos/joe_schmoe http://example.com/photos/joe_schmoe/123xyz ...similar to the way Flickr formats its URLs. The problem I'm having, though, is that the photos/:user route is either interpreted as the show method, or if I put those custom

Why is my rails route is a bit off?

别来无恙 提交于 2019-12-23 15:18:07
问题 I have my root route root :to => 'home#index' which is for my home controller and if i visit http://localhost:3000/ all works great i hit the proper home controller and index action. I then installed this gem rails_admin But when i visit http://localhost:3000/admin i hit the method in my application controller rescue_from CanCan::AccessDenied do |exception| redirect_to root_path, :alert => exception.message end and get this error, how is it possible that now i have a routing error...any idea

How to catch ParamConverter exceptions in Symfony2?

ぃ、小莉子 提交于 2019-12-23 14:21:28
问题 Here is the exception I got: No result was found for query although at least one row was expected. I am basically getting that exception when a user id is not found in database. Here is what my route looks like: localhost/../user/18 and the code in my controller: public function showAction(User $user){ // .. } I know I can use the kernel event exception to handle this, but is there an easier way to catch an exception generated by the ParamConverter? 回答1: In some cases it's useful to throw

How do I route user profile URLs to skip the controller?

感情迁移 提交于 2019-12-23 12:19:53
问题 Right now my user profile URLs are like so: http://example.com/users/joeschmoe And that points to the show method in the user controller. What I'd ideally like to do is offer user profile URLs like this: http://example.com/joeschmoe So, what sort of route and controller magic needs to happen to pull that off? 回答1: I disagree with what jcm says about this. It's not a terrible idea at all and is used in production by the two biggest social networks Facebook and MySpace. The route to match http:

Laravel NotFoundHttpException

风格不统一 提交于 2019-12-23 12:16:19
问题 I have a problem with this one route. Route::get('va/{$uniqueid}','AdminController@VaShow')->name('va'); and in controller: public function VaShow($uniqueid = '123'){ dd($uniqueid); } but i still get NotFoundHttpException when trying to visit route. (it have admin prefix but anyway i'm trying to access it directly with url and in view but still same) in view: {{route('va',['uniqueid'=>$v->uniqueid])}} and I checked in route:list, its there: | | GET|HEAD | admin/va/{$uniqueid} | va | App\Http

IIS7 MVC Routing Not Working

痴心易碎 提交于 2019-12-23 10:39:06
问题 Our company ships an MVC based product (targeting v4.5) which has stopped working on a customer site for what appear to be environmental issues - a build which worked with no problems once upon a time now gives a 403.14 - The Web server is configured to not list the contents of this directory . . What I think is happening... The user accesses http://server/AppName Because it's an MVC app, the default route ( Reports/Index ) should be used. Instead IIS is looking for a default document... ...

IIS7 MVC Routing Not Working

梦想的初衷 提交于 2019-12-23 10:38:59
问题 Our company ships an MVC based product (targeting v4.5) which has stopped working on a customer site for what appear to be environmental issues - a build which worked with no problems once upon a time now gives a 403.14 - The Web server is configured to not list the contents of this directory . . What I think is happening... The user accesses http://server/AppName Because it's an MVC app, the default route ( Reports/Index ) should be used. Instead IIS is looking for a default document... ...

Ruby on rails application root

五迷三道 提交于 2019-12-23 10:15:20
问题 How do I change a rails app so that a controller foo appears as the application root? In other words, right now all the urls look like host.com/foo/... and I'd like to get rid of the foo and have simply host.com/... 回答1: In routes.rb, add: map.root :controller => 'foo' Full details in the API. 回答2: In your routes.rb you add a named route like so: map.home '', :controller => 'foo', :action => 'index' This will build a route for when the root of web application is requested, it will use the foo

AngularJS Route Controller Not Reloading

混江龙づ霸主 提交于 2019-12-23 09:43:44
问题 I have a very simple AngularJS app that has two routes in it: #/search #/results When I navigate from one route to another everything works as I'd expected. Any resources that are needed are fetched and the content is displayed perfectly. The problem is when I navigate from one route to the same route (I.e., #/results to #/results) absolutely nothing happens. I understand from the browser's perspective nothing has happened but I'd really like AngularJS to reload the content. This must be very