views:

63

answers:

4

If you have a database driven website based on PHP / Cakephp , how do you make the database driven pages to look like somesite.html or somesite/ - so that the pages can be indexed by Google

  • or so that these pages can be directly linked to
+1  A: 

Hello,

You can easely do that with URL Rewriting

But that's not the most important part of Google indexation, it may even be productive cons!

G. Qyy
+2  A: 

Your question is so lacking in information that it's difficult to know what you're getting at.

First off, I'll make the assumption that you have a domain name. Let's call that www.yourdomain.com. You can use .htaccess to rewite that to http://yourdomain.com or, conversely to rewrite http://yourdomain.com to http://www.yourdomain.com using something like this in your.htaccess file, within the mod_rewrite section:

RewriteCond %{HTTP_HOST} ^www\.(.+)$

Now, if it's SEO friendly URLs or slugs you're after, then you'll need to do something along the lines of changing your view method parameter from $id to $url. You will, of course, need to have a url column on the table you're looking at and within the method you'll need to findByUrl($url) rather than read(null,$id). There are many well-documented ways to do this and an intelligent Google search will find them, so I won't spend a couple of hours describing them.

or so that these pages can be directly linked to

Anything you can see in the address bar of your browser you can link to.

pages to look like somesite.html or somesite/

The page name does not need to include .html to be indexed. If you don't believe this, google 'BBC' and find a page that ends '.html'

The bottom line is that if it's published and publicly accessible, Google will find and index it.

Leo
A: 

By following two rules, your data will be easily indexed:

  • The data currently show, should correspond to the current URL (e.g. /posts, /posts?dateBefore=2009 etc.)
  • All sites you wish to index must be linked from somewhere on the interweb. E.g. from your own site. (Or a sitemap.xml)

File extension in the URL do not matter. Google indexes every site served as text/html (and even images, pdfs...). It just must reach them.

sibidiba
+1  A: 

The web is based around URLs, not .html files. If it has a unique URL, it's a unique page that can be requested and indexed. example.com/products/view/3 and example.com/products/view/4 are both unique URLs and, as far as Google is concerned, completely separate pages. Whether these pages are lying around on your server's hard disk as 3.html and 4.html, are generated dynamically from database content or are hand-typed by trained monkeys on every request is completely irrelevant. If the content comes up when requesting a given URL, it's a page like any other.

Having URLs like example.com/foo.html is actually just a very simple and lazy implementation of web servers to map URLs 1:1 to files on the hard disk. This mapping is completely internal to web servers though, the "web" doesn't care about files at all.

If your pages have a URL they can be indexed.
If they're linked to from somewhere, they'll be found automatically.
Automatically generated links on and to automatically generated pages work the same as hand-coded links in static files.


In less abstract terms: Don't worry about it, Google will index your Cake pages just fine.

deceze