Solved

change default URL rails 2

Posted on 2011-09-13
8
328 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java - confuse using abstract class and class 13 508
Add a simple drop down from controller 5 381
What is 'f.hidden_field' for? 1 303
Javascript: handler for multi-select dropdown 8 106
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…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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