View Full Version : Link indexing

08-08-2008, 03:41 AM
A mate of mine told me to build my site in this way, rather than html. I think he said it saves on the whole page reloading.

Anyway, basically i have this script which pulls in the content from the pages.

<?php if ($_GET['page'] == '') { include 'pages/main.php'; } elseif (!file_exists("pages/" . $_GET['page'] . ".php")) { include 'pages/404.php'; } else { include "pages/" . $_GET['page'] . ".php"; }

And then I have this code in the links.

<a href="?page=project">project</a>

Now, I have 2 points/queries.

when the links are in the address bar they show up as www.meh.com/?page=project (not a good look) and secondly, he said that the code in the links will not be indexed by google either.

So I am a bit screwed when it comes to all that content when google can't even get past the index page.

I really dont know a lot about PHP.

Can someone give me some help or advice?


08-08-2008, 05:18 AM
You'll be looking into using .htaccess to change
that "bad looking" code into something nicer.

Look for tutorials on Rewrite Rules for .htaccess.


The deal about Google.

Here's a site that has an index page (index.php) and all of
the other pages are PHP codes that use "includes" ... there
are no static pages:

Clicking on "more results from this site" brings up a bunch of them:

So Google does index PHP scripted (coded) pages and I think that
"index.php" is really the only important file to have. All the rest of
the pages are arbitrary, and the content changes on those anyhow.


So you could choose to "clean-up" the URL in the address box
by using .htaccess, but in essence, who realy cares? And come to
think of it, look at all the URL's in the address box for this site?
PHP dynamic pages are pretty much the "norm" on the internet now.

08-08-2008, 05:23 AM
Google should index the page if a link is given to it, does't matter if the URL looks wierd. As for the fact that ?page=project is not userfriendly, with .htaccess and APACHE's mod_rewrite you can rewrite the urls into nice flat links. A nice tutorial for this is here (http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html), or perhaps here (http://corz.org/serv/tricks/htaccess2.php), and there are plenty of tutorials on google (http://www.google.com/search?aq=-1&oq=htaccess+url+rewriting+nice+link&complete=1&hl=en&q=htaccess+url+rewriting+nice+links&btnG=Search).