url-routing

Pyramids route_url with additional query arguments

和自甴很熟 提交于 2019-12-04 16:51:19
问题 In Pyramids framework, functions route_path and route_url are used to generate urls from routes configuration. So, if I have route: config.add_route('idea', 'ideas/{idea}') I am able to generate the url for it using request.route_url('idea', idea="great"); However, sometimes I may want to add additional get parameters to generate url like: idea/great?sort=asc How to do this? I have tried request.route_url('idea', idea='great', sort='asc') But that didn't work. 回答1: You can add additional

Routing URL Path with PHP and Apache

给你一囗甜甜゛ 提交于 2019-12-04 16:38:38
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'], 19) ; $URLElements = explode('/', $URL) ; // Adjust if needed. $class = $URLElements[0] ; $method =

How to have Express routing work with Angular routing with HTML5 style URLs?

吃可爱长大的小学妹 提交于 2019-12-04 14:49:22
问题 I would like to make an AngularJS app with HTML5-style URLs (i.e. with no # fragment in the URL). Thus in the routing controller module of my Angular app I've got something like the following: angular.module('app').config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider) { $locationProvider.html5Mode(true) ... } $routeProvider .when('/1/:param', /* do something */) .when('/2/:param', /* do something else */) .when('/3/:param', /* do something else again*/); A

Backbone.js and regex routing

北战南征 提交于 2019-12-04 14:39:28
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 ? 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

How to forward to the correct URL after login

浪子不回头ぞ 提交于 2019-12-04 13:49:56
问题 I have a website which has a web page containing list of logs. Now I usually give the link to access that page for some user eg : http://172.20.22.77/someapp/results.htm?id=45 Now when some user clicks on this .It would give him a login screen .But after login it does not go to the page that was intented . I am using sessions to implement the website and it has many pages, hence session is used to track the user browsing the page. kindly let me know how can i redirect the URL being asked

Automatically add parent model id in nested resources

▼魔方 西西 提交于 2019-12-04 13:40:51
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 @ad , etc., which automatically call the ad_path helper corresponding to the model class.) Shallow

building a PHP router [duplicate]

依然范特西╮ 提交于 2019-12-04 13:40:35
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: turn URL route into funciton arguments php mvc CMS Routing in MVC I'm currently trying to rewrite a PHP router. The new htaccess rewrite has the follows. <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/index.php?url=$1 [L] </IfModule> Whilst in index.php in public , I am getting the URL using the $url = $_GET['url']; What I need to do is to pass $url to the Router

Angular 2 routing raising 404 errors

落爺英雄遲暮 提交于 2019-12-04 13:10:19
HTML5 PushState means refresh URL or enter direct URL in browser works perfectly fine when I run my angular app using 'npm start' command from VS 2015 command prompt. However when I deploy same application on IIS and change <base href="/"/> to <base href="/MyVirtualApplication/" /> then HTML5's PushState or History API doesn't work properly and raising 404 error. Please do suggest. Bryan EDIT : IIS Setup for Url Rewriting: You need to install this to make the following work: http://www.iis.net/downloads/microsoft/url-rewrite First Step: Second Step: I found a link which explains the solution:

In Symfony, how can I require http in a dev environment and https in production?

女生的网名这么多〃 提交于 2019-12-04 13:00:26
In production, I have a group of routes that require SSL however this shouldn't be a requirement for development. I thought that I could simply override my routes in routing_dev.yml but that doesn't seem to work. When navigating to any route, it forces https. My Setup: app/config/routing_dev.yml contains a series of routes, duplicated from src/FOO/FOOBarBundle/Resources/config/routing, without schemes: [https] src/FOO/FOOBarBundle/Resources/config/routing.yml contains the same as above just with schemes: [https] I expected that the routes in routing_dev.yml would have preceded those in the

Flight PHP Routing from Subdirectory

爱⌒轻易说出口 提交于 2019-12-04 12:16:20
So I'm using the Flight PHP microframework ( http://flightphp.com/ ) to do routing. My question is, how can I run the router from within a subdirectory? What I mean is, essentially, run it 'sandboxed' within a folder. As in, a request to '/' just pulls the regular index.php file. But a request to '/flight/file' would load the URL using Flight. I know you can't just dump it in a folder on the server and expect it to work because FlightPHP expects the URLs relative to the root. Is there a way to run FlightPHP isolated in a directory with the rest of the website running regular PHP? EDIT I tried