Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

This question already has an answer here:

I recently noticed that my web page have problems with Google and good search results.

Many of the existing SEO tools suggests that my website uses bad URLs for SEO. I'm using a single PHP file that handles all the sections via parameters.

By example:

  • www.alanmarth.com/index.php (Main Page)
  • www.alanmarth.com/index.php?seccion=servicios (Services)
  • www.alanmarth.com/index.php?seccion=blog (Recent news)
  • www.alanmarth.com/index.php?seccion=blog&cat=2 (News category)
  • www.alanmarth.com/index.php?seccion=blog&id=3 (A single entry)

Is this ok? If it isn't, how can I solve it without having to rewrite my entire site?

share|improve this question

migrated from stackoverflow.com Jun 28 at 18:14

This question came from our site for professional and enthusiast programmers.

marked as duplicate by John Conde Jun 28 at 18:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Look into URL rewrite –  Fluffeh Jun 28 at 6:28
    
So your question is how to fix a purported issue without doing anything? –  mario Jun 28 at 6:51
1  
Actually not. I know it appears to be like that, but I expected that somebody who knows about the topic can give an specific answer (it is a common issue, but I wanted an answer focused in a SEO pointview). –  Alan Martin Revillagigedo Tula Jun 28 at 7:37
add comment

2 Answers

up vote 4 down vote accepted

Regarding: "Is this ok?"

No, its not good/intuitive for your users and hence not good for SEO. You should be using something like this

www.alanmarth.com/ (Main Page)
www.alanmarth.com/servicios (Services)
www.alanmarth.com/blog (Recent news)
www.alanmarth.com/blog/nameOfCategory2 (News category)
www.alanmarth.com/blog/titleOfBlog3 (A single entry)

Regarding: "how can I solve this without having to rewrite all my site?"

Are you talking about re-writing whole site code base or just the urls that are planted here and there? Re-writing whole code base is not necessary but you will have to replace the urls everywhere with the new SEO friendly urls. So you need to do following changes:

  • add to .htaccess file in your root folder with the following lines:

    RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L]

this will lead all your requests to be served by index.php

  • parse the $_SERVER['REQUEST_URI'] to figure out what section and category is this request all about. Like if the request uri is /blog this means that $_GET['seccion']=blog in your code. So map it accordingly. And so on.

Not much needs to be changed after that.

share|improve this answer
    
GREAT! I was expecting an answer like this. It appears that from now I shouldn't change any entry's title, and I must change every query to match for Title instead ID. Also, I have to rewrite every line where I request the GET method. Finally, this means that from now I can't access my site using parameters? or Is it not recommended? Because I see some guys just "redirect" the parameters to the path (I think it is for not changing links, or preserve prev external). Thank you again, and excuse my english :P –  Alan Martin Revillagigedo Tula Jun 28 at 7:33
    
Excuse me, but I have a little question: When I use REQUEST_URI, to get the "parameters" (I think i have to "explode" them by a "/"), How can i know if i'm dealing with an entry or a category? I have no idea. Thanks! –  Alan Martin Revillagigedo Tula Jun 28 at 7:46
    
You have to explode and map it with your url structure that you have defined. Basically write a Router class and define your url structure in that that. When a request comes take the request uri and explode it and map. You can also store your url structure definition in mysql (or any other) database. –  sri_wb Jun 29 at 6:18
add comment

Your URLs are not hurting your SEO very much. Google is able to crawl and index URLs with query parameters just as easily as "clean" URLs without them. As far as I can tell, Google doesn't use cleanliness of the URL as a ranking factor on its own.

URL parameters are slightly less friendly for users:

  • They make the URL longer
  • The introduce extra punctuation
  • They make the URLs hard for users to remember and type

Better usability can lead to higher rankings in Google.

There are also potential problems when using multiple parameters. You appear to be using a single parameter, so this may not apply to you. With multiple parameters order matters to Google, but not to your server. So:

  • /index.php?foo=bar&faa=baz
  • /index.php?faa=baz&foo=bar

will have the same content, but be seen as separated pages by Google. Creating friendly URLs is a good way to prevent this type of problem.

share|improve this answer
    
I don't think Google will regard those two as different pages. After all, in Webmaster Tools, you can specify how each parameter affects page contents, and how Google should react to it. So, Google definitely undestands URL parameters and the fact that their order does not matter. –  Tero Kilkanen Jun 29 at 13:21
add comment