url-routing

Grails - Language prefix in url mappings

放肆的年华 提交于 2019-12-01 14:10:09
Hi there im having problem with language mappings. The way i want it to work is that language is encoded in the url like /appname/de/mycontroller/whatever If you go to /appname/mycontroller/action it should check your session and if there is no session pick language based on browser preference and redirect to the language prefixed site. If you have session then it will display english. English does not have en prefix (to make it harder). So i created mappings like this: class UrlMappings { static mappings = { "/$lang/$controller/$action?/$id?"{ constraints { lang(matches:/pl|en/) } } "/$lang

How do I rewrite URL's based on title?

混江龙づ霸主 提交于 2019-12-01 11:35:40
This is a fairly open-ended question, and I'm just looking for the best possible avenue. Users can post links with titles. And I want my URL's for SEO purposes to display those titles. Much in the same way I believe stackoverflow works. So if the title is "My foobar just made out with my cat" I would like the URL to be : www.website.com/posts/My-foobar-just-made-out-with-my-cat Any ideas? Thanks so much in advance!! I used this in an old Rails 2.x app. There may be a better approach to scrubbing the title... (goes in your model) def to_param seo_uri end def seo_uri "#{self.id}-#{self.title

Using form_for with Nested Resources

无人久伴 提交于 2019-12-01 11:18:35
问题 I am building a To Do application in an attempt to get fluent with Rails. There are four levels of hierarchy in my app. User Goals (multiple goals per user) Tasks (multiple tasks per goal) Subtasks (multiple subtasks per task) I have a working front end form for each of these that utilizes nested resources. My routes.rb has something like this resources :goal do resources :task do resources :subtask end end What I would like to do now is that have all these forms right in one of the views of

How to Implement URL Routing with PHP + IIS?

徘徊边缘 提交于 2019-12-01 09:17:39
I wrote a content switcher script that uses dynamic URLs to pass parameters indicating what data is to be sent. For example to view the about page you would type: http://www.example.com/?page=about The issue is that this is not user friendly especially in my case where users will not necessarily be accessing this page via a link from the home page. What I would rather have the URL look like is: http://www.example.com/about/ Unfortunately I am running PHP5 on an IIS platform, not Apache, so this eliminates the most common methods that use mod-rewrite. I'm looking for examples of how to do URL

ASMX operation 404s, but ASMX service description doesn't, url routing issue?

北城以北 提交于 2019-12-01 07:25:29
问题 So I've found myself with a conundrum. We have some old asmx web services in our app that have worked fine for ages. All of the sudden they stopped working on the build server (CI). I say stopped working, because even though the service description displays when I navigate to the service, invoking any operation doesn't get routed to the service (Web Form Routing). There are 2 strange issues that arose in my attempt to fix this problem. 1.) After shelving all my pending changes, grabbing

CakePHP - How to do reverse routing with slug?

心已入冬 提交于 2019-12-01 05:54:55
I am using CakePHP 1.3. I have a Product model. on the DB table among others there are id and slug fields. If I have a product that is id:37 and slug:My-Product-Title I want the URL for the product to be: products/37/My-Product-Title Instead of the standard: products/view/37 I created a route that looks like this: Router::connect( '/products/:id/:slug', array('controller' => 'products', 'action' => 'view'), array('pass' => array('id'), 'id' => '[0-9]+') ); Now I can go to http://server/products/37/My-Product-Title and it takes me to the right place. But How do I get reverse routing to

Multiple Dynamic Segments in a Single Resource in Ember.js

大兔子大兔子 提交于 2019-12-01 05:12:49
Is there a way to have multiple dynamic segments with a single resource? My use case is to avoid letting the user hit index routes. Example: this.resource('tracks', { path: 'albums/:album_id/tracks/:tracks_id' }); And I'd like to avoid the user from hitting the following routes: albums/:album_id albums/:album_id/tracks albums/:album_id/tracks/:track_id Routes: this.resource('albums', { path: 'albums' }, function(){ this.resource('album', { path: '/:album_id' }, function() { this.resource('tracks', { path: 'tracks' }, function(){ this.resource('track', { path: '/:track_id' }); }); }); }); Any

How to make github pages url case insensitive?

安稳与你 提交于 2019-12-01 03:52:12
Website works for jerrygoyal.github.io/Flash-Clipboard but not for (404 error): jerrygoyal.github.io/flash-clipboard jerrygoyal.github.io/FLASH-clipboard jerrygoyal.github.io/flaSH-CLIPboard and so on You get the idea! How can I make the url case-insensitive? I've never worked on Jekyll and not sure if my project pages are using jekyll or not. I only created an index.html page and put inside the docs folder of the repository. I'm using a custom domain (www.jerryfactory.com) to map jerrygoyal.github.io Here's the URL to my Github Organisation site : https://github.com/JerryGoyal/jerrygoyal

How to render file in Rails 5 API?

自作多情 提交于 2019-12-01 03:41:11
I have a single-page application written in React with Ruby on Rails back-end (API mode). Rails is also serving static files. I'm pointing Rails router to public/index.html , so my SPA could manage his own routing with react-router . This is common practice in order to make direct links and refresh to work. routes.rb match '*all', to: 'application#index', via: [:get] application_controller.rb class ApplicationController < ActionController::API def index render file: 'public/index.html' end end The problem is this doesn't work in API mode. It's just an empty response. If I change the parent

CakePHP - How to do reverse routing with slug?

喜欢而已 提交于 2019-12-01 03:23:37
问题 I am using CakePHP 1.3. I have a Product model. on the DB table among others there are id and slug fields. If I have a product that is id:37 and slug:My-Product-Title I want the URL for the product to be: products/37/My-Product-Title Instead of the standard: products/view/37 I created a route that looks like this: Router::connect( '/products/:id/:slug', array('controller' => 'products', 'action' => 'view'), array('pass' => array('id'), 'id' => '[0-9]+') ); Now I can go to http://server