views:

254

answers:

9

My URLs look like "/pages.php?page=pageName" because I am using a database to supply the page's content. Does rewriting URLs to something like "/pageName" help search engines find the pages? If so how do I rewrite them?

A: 

It doesn't help the search engines find the page easier (in fact if not implemented properly it can make it harder for the search engines to crawl your site) but if done properly it will make your pages rank better for their relevant keywords

For PHP look at mod_rewrite for Apache

I'm not a regex expert but it uses pattern matching rules to perform the rewrite, there will be lots of documentation and tutorials online for mod_rewrite

Nick Allen - Tungle139
+2  A: 

Google's SEO Guide mentions a few tips regarding URLs under the "Improve the structure of your URLs" section.

Ben S
+3  A: 

Maybe a better question is "Does rewriting a URL help a user find the page in a search engine?". And the answer to this is "yes". For example, let's say that the content of your page discusses dolphins. Google puts more weight for the search term "Dolphins" into:

/Dolphins.php

than

/pages.php?page=1323

You'll find this is what most modern websites are doing (including stackoverflow).

Keltex
Even better: example.com/dolphinsUsers shouldn't need to remember file-types.
Ben S
Users don't remember file types, or urls for that matter. They click on links. If you don't have an extension at the end, e.g. example.com/dolphins, there's a chance that some portion of your inbound links will be to example.com/dolphins/ and others to example.com/dolphins/index.html, etc. This dilutes the google juice you get from those inbound links.
Lance Kidwell
@Lance I agree with you guys. And you can take care of the problem with the two versions with a link rel='cannonical'
Keltex
+9  A: 

It probably doesn't help a crawler to find the pages, but it may have a positive impact in how it's going to rank them, as better URIs get usually better ranking (other things being equal, of course). It's also good to have them permanent.

See Cool URIs don't change

About how you have mod_rewrite in Apache world and some other options in IIS world.

Example (Apache's syntax):

RewriteEngine On
RewriteRule ^(.*)$ pages.php?page=$1

That will pass everything in the URI after the domain name (there's a caveat regarding the trailing slash) to pages.php as a page parameter.

This is

http://yourdomain.com/bears

will return the content as served by

http://yourdomain.com/pages.php?page=bears
Vinko Vrsalovic
You don’t need to rewrite the requested URI path to the query. You can access the requested URI path together with the query with the `$_SERVER['REQUEST_URI']` variable.
Gumbo
That will not always be the case, though it will work in a PHP and Apache setup. Given that adding the variable is free, there's no need to rely on that feature that might not work in some other combinations.
Vinko Vrsalovic
A: 

It won't help the search engines to find them more easily. To make sure the search engines find your pages, the two most important things you can do are:

  1. Create a sitemap, reference it in your robots.txt, and register it with Google WebMaster tools

  2. Make sure you actually have spiderable, non-javascript links (preferably text links) to all the pages on your site.

Eric Petroelje
+2  A: 

You can create .htaccess file in root of site and add this into file:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/pages/(.*) pages.php?page=$1
sasa
A: 

The search engines will like your pages a lot more. If there is a dynamic file ending and a querystring, most search engines thinks it's a dynamic page, which will change soon, and therefore won't rank it as high as static pages.

Then you've got the rewrite in place, you can easily parse it in your PHP and decide your url structure with php.

kentos
+1  A: 

Check out this blog entry from google.

Specially this quote.

One recommendation is to avoid reformatting a dynamic URL to make it look static

Ólafur Waage
A: 

Would like to emphasis the need for an extension to the page, e.g. .html and the fact that slashes inside the url are interpreted as virtual directory paths inside the site's "tree map".

There is more "weight" as Keltex said in paths like category.html than /category/subcategory.html

Anyways it is mandatory to implement the friendly urls along with a sitemap. All that combined with basic SEO title,proper headings gives you a nice result.