Topic: SEO Friendly URL's

I found many solutions for replacing in the id in the URL with a text.

Instead of writing:
http://www.mysite.com/resources/3

I use:
http://www.mysite.com/resources/my-web-page

All I do is just adding a to_param in the model:

def to_param
  permalink
end

and in the controller:
@my_object = MyObject.find_by_permalink(params[:id])

My question is how to chain also on the URL the category name and its category name etc.

So I have link like this:
http://www.mysite.com/resources/my-main … y-web-page

I tried to and to the to_param:

def to_param
  "#{self.category.name}/#{permalink}"
end

The problem is with the "/" char.

I could use nested REST URL's but that's not my case plus I don't want to have a URL like this:
http://www.mysite.com/categories/my-mai … y-web-page

Many times I will need more than two levels of nesting.

This is very good for SEO. This way Google understands the structure of the site better and Google also gives a better rank for pages that the keyword is found in the URL.


Thanks a lot
this is a great forum (I'm new here)
Rami.

Re: SEO Friendly URL's

anything that does not look like machine generated is very important! IF you have a blogsite that is powered by wordpress there is an option in which you can set the url to the title of your content.

Link Building Services

Last edited by milesroces (2012-07-24 22:18:07)