url-routing

Most effective way to code SEO friendly URLs?

亡梦爱人 提交于 2019-11-27 16:58:40
问题 I currently use .htaccess and PHP to parse URLs in the following way: URL : http://blah.com/article/123_this-that-and-the-other .htaccess : RewriteEngine On RewriteRule ^article/([0-9]+)_(.+)/?$ index.php?page=article&id=$1 [L] PHP $page = isset($_GET['page']) ? safeGET($_GET['page']) : null; $id = isset($_GET['id']) ? safeGET($_GET['id']) : null; if ($page=='article') { include 'article.php'; } elseif { ... } I've begun running into problems with the far-too-paranoid Mod_Security engine that

Angular 4 Routing not working on live web-app

半世苍凉 提交于 2019-11-27 16:46:59
问题 My Angular 4 web-app routing works fine in my dev environment, and the menu redirects work fine on the live version. However, the dev version redirects to different pages by typing in the address field of the browser, but the live version doesn't. Is this an Angular problem? Or do I need to manage my redirects with my ISP? My app.router.ts code is as follows: import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent }

Organize routes in Node.js

不羁的心 提交于 2019-11-27 16:39:01
I start to look at Node.js. Also I'm using Express. And I have a question - how can I organize web application routes? All examples just put all this app.get/post/put() handlers in app.js and it works just fine. This is good but if I have something more than a simple HW Blog? Is it possible to do something like this: var app = express.createServer(); app.get( '/module-a/*', require('./module-a').urls ); app.get( '/module-b/*', require('./module-b').urls ); and // file: module-a.js urls.get('/:id', function(req, res){...}); // <- assuming this is handler for /module-a/1 In other words - I'd

Url Rewriting vs. Routing

好久不见. 提交于 2019-11-27 16:31:15
问题 I am making a making a new asp.net web forms site and would like to beautify my urls - I want to accept a url like this one "www.mysite.com/1-2,3" and turn it one like this "www.mysite.com/page.aspx?a=1&b=2&c=3". Which option is best for this task - IIS7 Url Rewriting or Routing in terms of performance and ease of maintenance . Btw I am planning to use medium trust shared hosting IIS7, maybe 6. In the past I used PHP's mod_rewrite, which I was quite happy with, however now this whole site is

Rails REST routing: dots in the resource item ID

本小妞迷上赌 提交于 2019-11-27 15:54:33
问题 I have following in my routes.rb: resources :users, :except => [:new, :create] do get 'friends', :as => :friends, :on => :member, :to => "users#friends" end and following in my user.rb: def to_param self.login end And when, for example, user with dots in login (for example 'any.thing') comes from facebook, rails gives routing error (no route found, I suppose that's because it recognises anything after dot as a format or because of route constraints). How can I come over this error? 回答1: You

Routing URLs in PHP

落花浮王杯 提交于 2019-11-27 15:10:56
I'm working on a web page project. I decided to use Apache, PHP (5.1.7, version imposed by my service provider) and Dwoo (templating) for this purpose. I want to route URLs to my templates. I'm aware there are many frameworks doing this kind of thing. I'm just wondering if there's a nice way to achieve it without. I've set up my project as follows: src/dwoo - Dwoo files index.php - This should handle routing. Currently it just renders the front page of the site using a template. templates - Templates that represent actual pages. There is minimal amount of business logic (no real model). It's

react-router : run is not a function

天涯浪子 提交于 2019-11-27 14:23:28
问题 A Egghead tutorial teaches it like this: var React = require('react'); var Router = require('react-router'); var routes = require('./config/routes'); Router.run(routes, function(Root){ React.render(<Root />, document.getElementById('app')); }); Yet I get this error: Uncaught TypeError: Router.run is not a function note: I've already updated react-router to the recent version. 回答1: Since the release of React Router v1.0, the run method has been removed, these breaking changes are documented in

How to Implement URL Routing in PHP

跟風遠走 提交于 2019-11-27 13:33:15
问题 How to implement URL Routing in PHP. 回答1: If you use Apache you can do the URL routing via mod_rewrite. Small example: RewriteEngine On RewriteRule ^(dir1)/?(path2)? main.php?dir=$1&path=$2 That'll have any request like http://yoursite.com/dir1/path1 served by http://yoursite.com/main.php?dir=dir1&path=path2 More examples here. The other alternative have every request redirect to a single php file RewriteEngine On RewriteRule (.*) main.php?request=$1 and then to do it in code, where you can

AngularJS: can't get html5 mode urls with ui-route $state

僤鯓⒐⒋嵵緔 提交于 2019-11-27 12:12:14
I'm using ui-router for state management but I think I'm having trouble with my .htaccess rewrite rules. All my states worked when using /#/account style urls. Now I've enabled html5 mode but my app isn't rendering as it was before. It seems to load my index.html and all my js and css files, etc. but not actually initialise any states. Here is my folder structure: root/ app/ components/ angular/ ... images/ scripts/ controllers/ directives/ ... app.js styles/ views/ .htaccess ... My vhosts DocumentRoot points to my app/ Here is my app.js with my states: 'use strict'; angular.module(

MVC role-based routing

ぃ、小莉子 提交于 2019-11-27 11:50:38
I have a project with 2 areas /Admin and /User. Admin's default route is /Admin/Home/Index and user's default route is /User/Home/Index . Is it possible to implement routing to make their home URL to look like /Profile/Index but to show content from /Admin/Home/Index for admins and /User/Home/Index for users? upd Finally find out how to do it context.MapRoute( "Admin", "Profile/{action}", new { area = AreaName, controller = "Home", action = "Index" }, new { RoleConstraint = new Core.RoleConstraint() }, new[] { "MvcApplication1.Areas.Admin.Controllers" } ); ... context.MapRoute( "User",