SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Code for making a page title part of the URL

    I currently use this format:

    http://www.oil-testimonials.com/essential-oils/7488

    But I keep reading that search engines prefer to have article names in the URL like this:

    http://www.oil-testimonials.com/esse...for-performers

    Don't URLs this long make it difficult for people to tweet the address to a friend? If this is really the path I should take, can someone point me to a good tutorial or something that will help me convert the article title into an appropriate add-on to the URL? For example, I'm guessing that words like a, of, the, it, etc. may want to be filtered out? And word's that have an apostrophe will need to be accounted for too. Is there a PHP function that does this?

    Thank you!
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SitePoint Zealot maxdream01's Avatar
    Join Date
    Feb 2011
    Location
    USA
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Contrary to popular belief, using these types of URL's does not aid search engines in any way, Google won't care how you structure your urls as long as they include keywords (at least that's what I have been led to believe), However, pretty urls are much more user friendly, because of their predictability, and they are really easy to implement too! For your other questions, when i implimented them on my blog i restructured the way I get to certain article from using ids to using a special url sequence that i derived from the title of the blog, i replaced spaces with hyphens and replaced apostrophes and other potentially harmful charechters as well using str_replace(). Here is a good tutorial on how to start using pretty urls: http://net.tutsplus.com/tutorials/ot...r-pretty-urls/

    Hope that helps!
    PHP is FUN

  3. #3
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by busboy View Post
    ....Don't URLs this long make it difficult for people to tweet the address to a friend?
    If you are really worried about tweet length then you could have a place on your page that has a 'tiny URL' version of the page URL displayed so that people could copy and paste the small URL and not adversely affect their tweet character count.

    If you are using Apache or IIS as your web server you could always use mod-rewrite to change http://www.oil-testimonials.com/essential-oils/7488 to http://www.oil-testimonials.com/esse...for-performers. You can google mod_rewrite or see dklynn's tutorial on it.

    Steve
    ictus==""


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •