PHP Search Engine Optimization - Session IDs
(Page 2 of 4 )
The first issue to deal with is PHP's tendency to add session ID numbers to links.
This is caused by having the "enable-trans-sid" option turned on, and it creates links with an additional, long, nonsense-looking GET variable. In addition to making the links clunky, it gives spiders different URLs with the same content, which makes them less likely to treat the pages individually. They might not even index them at all.
An example of this can be seen here:
http://www.mysite.com/index.php?PHPSESSID=b5dbe844a2c69fadc58614eb9a94b0 ce
Kind of ugly right? Now imagine being a search engine spider and seeing that long number change every time you look at the page. Not a pretty picture.
A quick way to fix this is to disable the trans-id feature, if you have access, in php.ini by setting "session.use_trans_sid" to false. If you don’t have access to change php.ini, you can add this line to the .htaccess file in your root directory:
php_flag session.use_trans_sid off
This will make the Session IDs disappear from the URL.
Friendly URLs
A major goal in optimizing your PHP pages for search engines is to make them look and act like static pages. If you have a large site you can use Apache to fake static-looking URLs, or, with a smaller site, you can simply keep your GET variables to a useful minimum. In either case, however, never allow a spider to see links with different URLs to the same content. If the URL is different, the page should be, too.
One of the major problems most webmasters have with getting their dynamic pages to index is URL cleanliness. Since many dynamic pages are created with GET variables, lots of pages have URLs that look like:
Page.php?var=abc&var2=def&var3=ghi
Most of the search engines will be able to follow this link, because it has three or fewer GET variables (a good rule of thumb is to keep the number of GET variables passed in the URL to less than three), but any more than three variables will cause you to run into problems. Try using less GET variables, and make them more relevant. Rather that useless id numbers, use titles and other keyword rich bits of text. This is an example of a better URL:
Page.php?var=category&var2=topic
If the page requires more variables, you may want to consider combining the variables by delimiting them with a hyphen or another unused character, and then splitting the variable in the target page.
Next, we'll cover two methods of making your dynamic URLs more friendly. The first is mod_rewrite:
Next: Mod_rewrite >>
More Search Optimization Articles
More By Roger Stringer
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|