url-routing

Ember.js Routing: match end of url

為{幸葍}努か 提交于 2019-12-07 05:36:22
问题 I need to match a path into an URL. The path has to be the end of the URL after a given pattern, but I can't do it. Ember.js always end it's matching to the next slash. var router = Ember.Router.extend({ location: 'history', enableLogging: true, root: Ember.Route.extend({ index: Ember.Route.extend({ route: '/' repo: Ember.Route.extend({ route: '/:repo_id', index: Ember.Route.extend({ route: '/' }), files: Ember.Route.extend({ route: '/files', index: Ember.Route.extend({ route: '/' }), sub:

PHP routing for friendly URLs help

自古美人都是妖i 提交于 2019-12-07 05:29:43
问题 I am building a website that runs all of the code trough index.php. For example index.php?controller=something&id=01234 . I want to use PHP to create friendly URLs, so I do this: $request = str_replace('/root/', '', $_SERVER['REQUEST_URI']); $params = explode('/', $request); $controllers = array('first_c', 'second_c', 'third_c'); if (in_array($params[0], $controllers)) { include($params[0]); // just to give an example } Then with a mod_rewrite rule RewriteRule ^.*$ ./index.php I redirect

Is there a simple way to implement routing in JSF?

不羁的心 提交于 2019-12-07 04:27:46
问题 I am trying to implement a "generic" view where (part of) the content displayed depends on the URL. E.g. If /somepath/somepage.xhtml points to a non existing file, instead of going straight to a 404 error I want to try to retrieve /somepath/somepage.xhtml 's content from the database using a generic view, /genericview.xhtml , where I have something like: <h:outputText value="#{genericViewBean.content_lg}" escape="false" /> which, if found by the backing bean, would output the content of the

Redirecting an old URL to a new one with Flask micro-framework

自闭症网瘾萝莉.ら 提交于 2019-12-07 03:37:30
问题 I'm making a new website to replace a current one, using Flask micro-framework (based on Werkzeug) which uses Python (2.6 in my case). The core functionality and many pages are the same. However by using Flask many of the previous URLs are different to the old ones. I need a way to somehow store the each of the old URLs and the new URL, so that if a user types in an old URL they are simply forwarded to the new URL and everything works fine for them. Does anybody know if this is possible in

How to route legacy type urls in ASP.NET MVC

余生长醉 提交于 2019-12-07 03:07:36
Due to factors outside my control, I need to handle urls like this: http://www.bob.com/dosomething.asp?val=42 I would like to route them to a specific controller/action with the val already parsed and bound (i.e. an argument to the action). Ideally my action would look like this: ActionResult BackwardCompatibleAction(int val) I found this question: ASP.Net MVC routing legacy URLs passing querystring Ids to controller actions but the redirects are not acceptable. I have tried routes that parse the query string portion but any route with a question mark is invalid. I have been able to route the

Angular: Setup routes depending on service method call

亡梦爱人 提交于 2019-12-07 00:28:26
问题 I have route configuration set up via @NgModule . And I have a service that identifies what parts of the application should be shown for the user depending on certain conditions. I need to call that service and setup the routes according to the returned value. Problem: Route configuration is setup inside an annotation and I can't get how to call the service in such setup. To be more specific here is the example configuration I want to enhance. My current routing setup: const appRoutes: Routes

Asp.net allow access only through routes?

て烟熏妆下的殇ゞ 提交于 2019-12-06 17:46:25
I am using URL rewrite to make user-friendly URL's. So www.mysite.som/search is being handled by www.mysite/search.aspx correctly. But there is one more thing I want. I want to prevent direct access to my page search.aspx . So, if someone enters www.mysite.com/search.aspx, he should be redirected to www.mysite.com/search instead. What have I tried? <rewrite> <rule name="Redirect to friendly" stopProcessing="true"> <match url="^(.*)\.aspx$" /> <action type="Redirect" url="{R:1}" /> </rule> </rewrite> But its not working. 来源: https://stackoverflow.com/questions/11483899/asp-net-allow-access-only

Can't get javascriptRoutes to work with Play Framework 2

偶尔善良 提交于 2019-12-06 14:41:10
问题 I'm trying to use javascriptRoutes in Play 2 (Scala) and I am getting an error (see below). Here is what I did: Add javascriptRoutes method to Application controller def javascriptRoutes = Action { implicit request => import routes.javascript._ Ok(Routes.javascriptRouter("jsRoutes")(Orders.searchProducts)) .as("text/javascript") } Add route to routes file GET /assets/javascripts/routes controllers.Application.javascriptRoutes Add <script> import to main.scala.html <head> ... <script type=

codeigniter how to set routes to default controller according to the no of uri segments

◇◆丶佛笑我妖孽 提交于 2019-12-06 14:37:58
问题 I am using codeigniter as a module in my project to display information as categories and its items. I want the url's like the following sitename.com/module/ will display all items in random order. sitename.com/moduel/categoryname/ will display all items in that specific category sitename.com/module/categoryname/title-of-the-item/ this will display the details of that specific item here sitename.com/module/ is the root of the codeigniter and the default controller is home. my question is how

How can I hide user_id from URL using yii framework?

安稳与你 提交于 2019-12-06 14:32:34
I am using the yii framework and have different user accounts. When I want to have a look at the view page of user 4 I have to enter an url like www.mydomain.com/user/4 for update I have www.mydomain.com/user/update/4 . Is there a way so that I can hide the user id from the url line? How can I set a route like www.mydomain.com/user/username and www.mydomain.com/user/update/username ? Do I have to modify the routes? What if the username contains an @ symbols? If each user has a unique username, you can describe a route that doesn't show their user id by putting this custom routing rule in