friendly-url

Rails 3 routing how to match multiple?

大憨熊 提交于 2019-12-24 09:28:05
问题 How do I match multiple controller for example an id? I have tried this in my routes: match '/:id' => 'kategoris#show' match '/:id' => 'tags#show' 回答1: Rails controller routing isn't appropriate for you if you're wanting to match http://example.com/<something> . You could create a single ThingsController: match '/:id' => 'things#show' and then do something appropriate in your ThingsController. Eg. in Sinatra (which you could mount as a Rack middleware) you'd do this: get "/:id" do :id if(@tag

Add/remove Cake named URL parameter for a link

那年仲夏 提交于 2019-12-24 08:45:57
问题 Using CakePHP 1.3 there are named parameters in the URL like .../name:value/... These are used for example by pagination links .../page:2/key:date/sort:desc/... How to generate links with HtmlHelper::link() adding/deleting such named parameters from the current URL? Basically I want create links to add/remove/modify the category:ID named parameter in the current URL. It must not touch the URL, anchor, other named parameters, GET parameters in the URL. Or how can I pass named parameters to

Add/remove Cake named URL parameter for a link

你。 提交于 2019-12-24 08:41:00
问题 Using CakePHP 1.3 there are named parameters in the URL like .../name:value/... These are used for example by pagination links .../page:2/key:date/sort:desc/... How to generate links with HtmlHelper::link() adding/deleting such named parameters from the current URL? Basically I want create links to add/remove/modify the category:ID named parameter in the current URL. It must not touch the URL, anchor, other named parameters, GET parameters in the URL. Or how can I pass named parameters to

How can I shorten the URL query paramters?

五迷三道 提交于 2019-12-24 05:47:32
问题 My script is generating a very long URL just like the one below and I wonder how this can be shorten with an algorithm or technique? This is the long URL: http://example.com/script.php?param1=value1&param2=value2&param3=value3&param4=value4&param5=value5 I want to shorten it to something like this: http://example.com/script.php?p=430x2920 How can I do this with out caching the original link the database? Thanks in advance. 回答1: You could always just use a single param with a delimiter and

Special Characters in URL

こ雲淡風輕ζ 提交于 2019-12-23 20:03:08
问题 We're currently replacing all special characters and spaces in our URLs with hypens (-). From an SEO and readability point-of-view this works fine. However, in some cases, we are feeding parts of the URL into a search after stripping the hyphens out. The problem occurs when the search term should have hyphens as it returns no results when they get stripped. We could modify the search algorithm we're using but this will slow it down (especially bad as we're using it with an AJAX-ed search box

URL convention for date range

╄→гoц情女王★ 提交于 2019-12-23 08:28:34
问题 What would be the accepted convention for displaying a date range in a friendly URL? For example, in a time tracking application. Instead of using the database's primary key for a specific pay period in the URL, I would like to use something more easily distinguishable to the user. http://www.mytimesheet.com/11-1-2009-11-14-2009 http://www.mytimesheet.com/period-beginning-11-1-2009 Neither of those seem to cut it, but maybe I'm just being overly critical. 回答1: Have you considered ISO format

ModX Revo: friendly URLs not working

一笑奈何 提交于 2019-12-23 05:09:30
问题 This seems to be a common issue but I have tried all the suggestions and none work. The issue is when I turn on Friendly URLs in ModX Revo all my links get broken (404s). The URLS do appear correct with the alias after them. Heres what I've tried: Changing ht.access to .htaccess Ensuring the correct path is present in MODX_BASE_PATH in the confic.inc.php file Ensuring all FURL settings in System Settings are ok and correct Clearing browser and ModX caches If anyone can suggest something I've

Dynamic URLs on Struts 2

半腔热情 提交于 2019-12-23 05:03:40
问题 I'm creating an application using Struts2 and I want to have friendly URLs. Si, i set the following params in struts.xml: <constant name="struts.action.extension" value=""/> <constant name="struts.enable.SlashesInActionNames" value="true"/> <constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/> and my actions: <package name="notes" namespace="/notes" extends="struts-default"> <action name="/*/*" class="action.ViewNoteAction"> <param name="title">{1}</param> <param name="id">

Dynamic URLs on Struts 2

时光毁灭记忆、已成空白 提交于 2019-12-23 05:03:25
问题 I'm creating an application using Struts2 and I want to have friendly URLs. Si, i set the following params in struts.xml: <constant name="struts.action.extension" value=""/> <constant name="struts.enable.SlashesInActionNames" value="true"/> <constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/> and my actions: <package name="notes" namespace="/notes" extends="struts-default"> <action name="/*/*" class="action.ViewNoteAction"> <param name="title">{1}</param> <param name="id">

Rewriting old urls to pretty urls, and redirect old urls to new with .htaccess

眉间皱痕 提交于 2019-12-23 03:32:11
问题 I have some problems with .htaccess settings. My Website home page url is : http://www.domain.com/b/en/index.php ,and I use mod_rewrite to create pretty url : http://www.domain.com/en This is my rewrite rules for pretty urls (It works): RewriteRule ^en/(.*)$ /b/$1 [L,QSA,NC,PT] That's pretty urls what I want, but when I redirect "old urls" to new urls, there are some problems. My Chrome browser shows " www.domain.com redirected you too many times. " This is my old urls redirect to new rule: