Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:18:07+00:00 2026-06-13T00:18:07+00:00

Urls are (for an unclear reason, generate different problems/no real advantage) defined case sensitive

  • 0

Urls are (for an unclear reason, generate different problems/no real advantage) defined case sensitive by w3.

What are my possibilities in routes.rb match case insensitively?

here the matching:

match '/:foo/library/:bar' => 'library#show'

Url Example: /europe/library/page4711

calls show action in library controller with { :foo => “europe”, :bar => “page4711” }

What I want are 2 things:

  • the param value of :foo needs a .downcase so /Europe should be {
    :foo => “europe” }
  • library should match case insensitively (ie. /Library, /LIBRARY,
    /liBRarY all should match)

How do I do this in routes.rb?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:18:08+00:00Added an answer on June 13, 2026 at 12:18 am

    Ok, to answer my own question:

    There is no good way to do this within Rails routes.rb.

    Here what I did:

    For the first thing I created a before_filter in my controller:

    before_filter :foo_to_lower_case
    
    def foo_to_lower_case
      params[:foo] = params[:foo].downcase
    end
    

    For the second one I created a load balancer rule to get it lowercase to the rails app. Of course you can define a nginx/apache rule as well instead.

    Edit: I found another solution for the second part because I disliked the pre-parsing/replacing of every url.

    I made “library” to a symbol and wrote a constrained for it which only accept any form of the word “library”.

    So the line in routes.rb looks like:

    match '/:foo/:library/:bar' => 'library#show', :constraints => { :library => /library/i }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my urls to be case insensitive. Adding (?i) to the beginning
In urls.py, I defined as, url(r'^'+settings.URL_PREFIX+r'$', 'myapp.project.views.index', name=homepage), in settings.py, I defined URL_PREFIX as,
I am seeing different URLs being generated by Liferay 6.1 GA2 on different machines
Example URLs http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I Any regex that will pull the correct YID
I need to process URLs with JS and find out if they belong to
I have two URLs. https://wimp.supremosolutions.com/api/v1/spot/?format=json https://wimp.supremosolutions.com/api/v1/spot/?format=json&latitude=45.200375&longitude=9.992465000000001 If I run the first one through my
The following function rewrites urls from news and product titles that contain all sorts
here is my code: urls.py: from django.conf.urls import patterns from views import show,showpage urlpatterns
I have implemented clean URLs using the following in my .htaccess RewriteEngine on RewriteCond
I've got legacy URLs like: mysite.com/index2.php?option=com_mtree&task=print&link_id=383&Itemid=168 and I'd like to redirect any URL that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.