Replacing ?php stuff from URL with SEO friendly link

9 replies
  • WEB DESIGN
  • |
Hello,

I had a custom CMS done for me at RAC. When I setup a product page the URL is displayed like this:

http://www.mydomain.com/product_detail.php?id=84

Is there a way I can have those links displayed as user friendly URL like

http://www.mydomain.com/product-keywords

It's not a feature built into the CSM (I thought about it after the fact) and I can't get a hold of the developer. Is there anything I can do? Perhaps in the .htaccess?

I recall there was a script or something that would allow this to be done for Joomla. Any suggestions?

Thanks.
#friendly #link #php #replacing #seo #stuff #url
  • Profile picture of the author Mantero Cantrow
    what cms are you using? Joomla? or custom made?

    if custom, you can use modrewrite for this.

    this forum will help you a lot http://forum.modrewrite.com
    {{ DiscussionBoard.errors[230340].message }}
  • Profile picture of the author phpnetpro
    .htaccess is definitely the way to go with this
    Writing a modrewrite command for htaccess to handle something like that will be fairly simple. You will find the hard part is going to be modifying the script to reflect those changes. Anywhere that url structure is used will need to be changed to reflect the new structure.

    I've done a number of projects involving this and your best option is to have some kind of unique identifier used as the url. When you have lots of products that may have same/similar names, this can become a problem. The easiest thing to do is make a url that involves the product title as well as a database id # that can be used to identify it (ie, product_detail.php?id=84 might become Product_Name_84.html). Your modrewrite command would then look for the .html calls and send along the numeric value at the end as the id # for product_detail.php.
    Hope that made some kind of sense and will provide some help.
    Ryan
    Signature
    Need more organic search traffic? SideBacon SEO Agency is a leading provider of Fort Myers SEO services to local businesses.
    {{ DiscussionBoard.errors[231411].message }}
    • Profile picture of the author Alan Petersen
      Thanks for the tips. I've been kicking the mod_rewrite around. What I did was create a folder on www called product_name.

      Then I added this code to my .htaccess file:

      Code:
      Options +FollowSymLinks
      RewriteEngine on
      RewriteRule product_detail/(.*)/(.*)/$ /product_detail.php?$1=$2
      So the Rewritten URL would be:

      http://www.domain.com/product_detail/id/85/

      Instead of:

      http://www.domain.com/product_detail.php?id=85

      And it works but none of my images file show up and when you click on home I get a 404. I'll probably put this out for bid on RAC so I don't waste a lot more time on this.

      Thanks for the info!

      P.S. Any ideas what is a fair amount to pay for this? I would assume for a coder it would be a pretty simple thing to setup this for me.
      Signature
      {{ DiscussionBoard.errors[231485].message }}
  • Profile picture of the author wayfarer
    http://www.domain.com/product_detail/id/85/

    is not more SEO friendly than

    http://www.domain.com/product_detail.php?id=85

    IMHO

    Probably the reason you're getting a 404 when you click on home, and the reason the images don't show up, is that, when you have the URL rewritten like that, the browser considers you to be up 2 directory levels, and so, if the link paths (including the one for the images), are not relative to the root (/path/to/image.jpg) - note the slash at the beginning, and are relative to the page instead (path/to/image.jpg), you will get a 404 or missing image because it is looking in the wrong place.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[231612].message }}
  • I agree, the search engines have absolutely no problem with dynamic urls.

    Think about all the phpbb etc. bulletin boards out there that have every single post indexed in google.


    robert
    {{ DiscussionBoard.errors[232380].message }}
    • Profile picture of the author Alan Petersen
      Originally Posted by lumpy burgertushie View Post

      I agree, the search engines have absolutely no problem with dynamic urls.

      Think about all the phpbb etc. bulletin boards out there that have every single post indexed in google.


      robert
      That contradicts what I've read in the past. I'll have to do some more research on that. It's not as much as to just get indexed but rank well for certain long tail keywords. If I'm trying to rank for "weight loss" but the URL is /product_detail.php?id=85 and "diet pills" URL is /product_detail.php?id=86 I might rank well for product_detail not "weight loss" and "diet pills". Thanks.
      Signature
      {{ DiscussionBoard.errors[232407].message }}
  • Profile picture of the author wayfarer
    Google only looks at the URL if there is nothing in the title, and no headers. Although there is plenty of information that says you need to optimize the name of your page, I think there is more myth than truth in the idea, and the general consensus among SEO professionals that I communicate with, is that it matters very little.

    Way back in the 1990's it was hard for search engines to read dynamic URLs that were really long, and they would stop parsing them after a certain length, which is where this myth came from.

    Even if the name of a URL has a measure of weight, the way you rewrote it, it wouldn't help, since you didn't rewrite it to be semantically meaningful:
    The main reason to do rewriting is to make the web addresses more user-friendly, and easier to type.

    Basically, what is happening in the query product_detail.php?id=85 is that the program is finding the product on row 85 of your products table, and using all the information there to build the page. Another thing you could do, is query the table using the name of the product, then pass that name in a variable, and then rewrite it as a friendly URL. That does introduce some security issues, but they are easy enough to deal with. The problem with this approach is, that it won't work if there are two products that are named the exact same thing. There are a couple ways to deal with this, such as including the product number in the query string, but I doubt it is really worth the effort.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[232616].message }}

Trending Topics