Solved

change default URL rails 2

Posted on 2011-09-13
8
326 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Accepted Solution

by:
Andrew Doades earned 250 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now