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 6824087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:51:38+00:00 2026-05-26T21:51:38+00:00

When I use redirect_to ‘index’ in my controller I get the following error. -on

  • 0

When I use redirect_to 'index' in my controller I get the following error. -on Ruby 1.8.7 and Rails 3.1.1-

Started GET "/presentations/1" for 127.0.0.1 at Tue Nov 15 01:48:42 +0200 2011
  Processing by PresentationsController#show as HTML
  Parameters: {"id"=>"1"}
Redirected to http://localhost:3000index
Completed 302 Found in 2ms
[2011-11-15 01:48:42] ERROR URI::InvalidURIError: the scheme http does not accept registry part: localhost:3000index (or bad hostname?)

And this is how it looks in routes.rb

..
get 'about_us' => 'presentations#index', :as => 'about_us'
..
resources :presentations

Apparently it’s trying to redirect to http://localhost:3000index instead of http://localhost:3000/presentations/index but I couldn’t get why. If I use redirect_to presentations_path or redirect_to :controller => 'presentations', :action => 'index', it’s all working just fine but why this is happening? I thought I should be able to use redirect_to without defining any controller parameter if it’s referring the same controller with the existing setup or am I wrong?

  • 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-05-26T21:51:39+00:00Added an answer on May 26, 2026 at 9:51 pm

    As per your current routes file, you say

    /about_us routes to {:controller => :presentations, :action => :index}
    

    So, if you were to type

    redirect_to '/index'
    

    It would work just fine. Type, rake:routes in your console to ensure routes are generated as you want them to.

    Also, http://guides.rubyonrails.org/routing.html might be an excellent resource for you to get started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Rails app sometimes you use a redirect in an action... redirect_to :controller
In ruby, if you use mechanize following 301/302 redirects like this require 'mechanize' m
I am trying to use this redirect_to redirect_to :controller => :note_categories, :action => :destroy,
What function to I use to redirect to the default 404 error page? Sample
So I have a controller called Music with one action which is index. On
I'm trying to render from a pnr controller to the index of a web_services
I am trying to use redirect tag for directing index page to the home
I use the following example Redirect to redirect to a page. What i need
How do you use redirect_to when the Edit action is dependent on a parameter
I am looking to use rails to redirect links that I am sure are

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.