Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

change default URL rails 2

Posted on 2011-09-13
8
Medium Priority
?
348 Views
Last Modified: 2012-08-14
rails 2.3 app, the index is example.com/

for seo i want the home page URL to be example.com/something how do i use routes.rb to make this happpen?
0
Comment
Question by:depassion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Accepted Solution

by:
Andrew Doades earned 1000 total points
ID: 36531927
Something like this:

map.root :controller => welcome', :action => 'index'
0
 

Author Comment

by:depassion
ID: 36531935
i already have

 map.root :controller => 'info', :action => "index"

that makes example.com/ how to i add the /something?
0
 
LVL 10

Expert Comment

by:Andrew Doades
ID: 36531960
So when you first boot or access your site on example.com you want it to redirect to example.com/something?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:depassion
ID: 36531986
yeah i think so, i just want to add a keyword into the URL for SEO optimization.

example.com/something is the same as example.com/ with this:

map.something "/something", :controller => 'info', :action => "index"

0
 
LVL 10

Expert Comment

by:Andrew Doades
ID: 36532033
OK, so (sorry if I'm missing something!) can't you just use those two routes?

map.root :controller => 'info', :action => "index"
map.something "/something", :controller => 'info', :action => "index"

So, http://example.com/  goes to controller 'index' action 'welcome' and if people type http://example.com/something it still goes to controller 'index' action 'welcome'?

Andrew
0
 
LVL 12

Assisted Solution

by:JESii
JESii earned 1000 total points
ID: 36533477
To clarify: is "something" a page that you have created yourself and is it different from the "index" page? Or is it a controller called "something" that you want to create?

What do you want to put on that page and why do you want it to be separate? Since you mention "seo", I'm guess that the word "something" is key to your site... right?

So. Create a controller called "something", add an action/page called "index", then do a
     map.something "/something", :controller => 'something', :action => "index"
similar to what #doades mentioned earlier.
0
 

Author Comment

by:depassion
ID: 36535512
there is no difference in the /something compared to the home page. Maybe all i need to do is submit the URL to google as www.example.com/something as the home page.

yeah the "something" keyword is just for SEO.

getting keywords in the URL as much as possible helps with SEO
0
 
LVL 12

Expert Comment

by:JESii
ID: 36537835
Fine. Then the suggestion to map "/something" to whatever you want your home page to be is the way to go.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question