Welcome to WebmasterWorld Guest from

Forum Moderators: mademetop

Message Too Old, No Replies

PHP SELF querie (indexing?)

is it bad practice to use PHP_SELF to include content for SEO?

3:41 am on Dec 6, 2011 (gmt 0)

New User

5+ Year Member

joined:Jan 31, 2008
posts: 20
votes: 0

Hello, I must say that I can't make up my mind about anything related to SEO, cause there are so many different opinions. But I would be very grateful if someone could help me with the problem I post:
I have a web page where all the navigation points to content that is included in the same html document using the server variable PHP_SELF. That means that the html document, and the title of the document, will remain the same. I use a switch instruction to decide wether to include one or another content.
Now I would like to ask ¿will my content still be indexed by search engines? I know Yahoo differs from Google, and there are probably many differences among search engines. But is it generally a bad practice to do so?
The way the web page is made calls PHP_SELF with different queries, and then includes diverse content based on a switch instruction. The thing is that I can't make up my mind about changing the code so that I use a template (home made, so to say) and use the template to reproduce the contents with the navigation still in place.

The images related to the content also change by means of the switch instruction, like so:
if (isset($_GET['pagina'])){switch ($_GET['pagina'])
{case "tesis":
echo "Imprimimos, encuadernamos y le damos el mejor acabado a tu Tesis";
$titulos[]="Tesis urgentes en menos de 4 horas";
$titulos[]="Tesis con pasta dura o blanda";
$titulos[]="Acabado profesional de tu tesis";
$titulos[]="Encuadernaciones diversas tales como holandesa y mestiza";
$titulos[]="Cubiertas doradas, en serigrafía, grabadas o laminadas";
$titulos[]="Puedes elegir las cubiertas de tu tesis";
$titulos[]="Tesis urgentes con encuadernado térmico";
$titulos[]="Puedes elegir encuadernación con tela, keratol o piel";
And using the following in the img tag:
<img src="images/<?php $imagen=isset($_GET['pagina'])?($_GET['pagina'])."1".'.jpg':'primera.jpg'; echo $imagen; ?>" alt="Multimagen" width="450" height="225" title="" rel="<h3><?php echo $titulos[0]; ?></h3>"/>
for example.
And the links use the following structure:
<li class="kwick1"><a href="<?php echo $_SERVER['PHP_SELF'];?>?pagina=tesis">Tesis</a></li>

Then on the content div (where I want the different content to appear), it goes:

if (!isset($_GET['pagina']) || !$_GET['pagina']) {include_once('main.php');}else{
$paginas_permitidas=array('tesis', 'ploteo', 'impresion', 'varios', 'main', 'contacto', 'ubicacion');
if (isset($_GET['pagina']) && in_array($_GET['pagina'], $paginas_permitidas)) {

¿Am I definitevly off? ¿Does this mean that search engines will not index the content of the web page? I think it's better to include more than one page on the site, no doubt, but that leaves including dynamic content like this out. So can somebody give me a plain answer?
9:16 am on Dec 6, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 27, 2003
posts: 1642
votes: 0

Google only sees the HTML output at the end - it doesn't matter how you generated it.
You may encounter problems if your algorithms show the same page for different urls, but the technique done properly doesn't came problems.
2:40 am on Dec 7, 2011 (gmt 0)

New User

5+ Year Member

joined:Jan 31, 2008
posts: 20
votes: 0

Thanks leadergroot, what I am trying to do is a navigation that works like a frame but without the frames. I have a left navigation and all the content appears right and the images on top of the content. Like I said, this causes the url only to change after the query part, like www.multimagen.com.mx/principal.php?pagina=#*$!. I presume I'm doing it right cause I don't get any errors or notices from php, but I don't know how many search engines actually search after the "?", I've read there are many who stop indexing past that point, and some people recommend rewrinting the url to a static one, though Google specifically advises otherwise. I really think I should stop bothering but I've had other sites where SEO becomes a real problem and those problems become difficult to solve once your pages are indexed, (those sites were flash made, though);) What bothers me is to have only one document title for all the pages, but it would be even worse if search engines didn't look past the query and ignored the content. About this last issue, ¿should I stop worrying?
Thanks again.
2:52 pm on Dec 7, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Apr 30, 2007
votes: 0

I don't know how many search engines actually search after the "?"

All. They will treat the pages as different ones.

The meta-tags should follow a similar concept as you special case the content. Ideally you emit different meta-tags for the different pages.

Also there is a common mistake with the default parameters happens in many cases.
if (!isset($_GET['pagina']) || !$_GET['pagina'])

The "if" statement will become true for different urls. In fact for an endless number of urls. So if the parameter is not what you expect but it is set, you should perhaps do a 301 or 404 instead of displaying regular content, therefore validate the parameter much earlier before any output (as you are using it to point to an image and later on to include a php file, not good for security).