Dynadot โ€” .com Registration $8.99

SEO URLs

Spaceship Spaceship
Watch

SiKing

Registered MemberEstablished Member
Impact
6
Hi. Wasn't sure whether to put this in the SEO forum or not but anyway..

I have been following the tutorial located here: http://www.sitepoint.com/article/search-engine-friendly-urls/2

Basically it's a custom 404 page in PHP called processor.php and includes the relevant page. It says to add "header("HTTP/1.1 200 OK");" in the file. I assumed this was for Search Engine reasons. However, whenever I check for broken links on w3.org, it says all my links are broken (404) but entering the URL into the browser, the page is clearly displayed.

Advice is appreciated and rep/np$ will be donated accordingly.

Thanks :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
Could you post all your code, along with the URL address etc. :hehe:

Thanks! :)

Dan
 
0
•••
Ah yeah, sorry.

Website: http://www.sqldumpster.com

processor.php:

PHP:
<?php
header("HTTP/1.1 200 OK");

session_start();


$uri = $_SERVER['REQUEST_URI'];
$uri_array = explode("/",$uri);

function count_all($arg)
{
 // skip if argument is empty
 if ($arg) {
   // not an array, return 1 (base case)
   if(!is_array($arg))
   return 1;
   // else call recursively for all elements $arg
   foreach($arg as $key => $val)
   $count += count_all($val);
   return $count;
 }
}

$num = count_all($uri_array);


$page		=	$uri_array[1];
$uri_var_1	=	$uri_array[2];
$uri_var_2	=	$uri_array[3];

include $page.'.php';

?>
 
0
•••
A guess:

PHP:
<?php

$uri = $_SERVER['REQUEST_URI'];
$uri_array = explode("/",$uri);

function count_all($arg)
{
 // skip if argument is empty
 if ($arg) {
   // not an array, return 1 (base case)
   if(!is_array($arg))
   return 1;
   // else call recursively for all elements $arg
   foreach($arg as $key => $val)
   $count += count_all($val);
   return $count;
 }
}

$num = count_all($uri_array);


$page        =    $uri_array[1];
$uri_var_1    =    $uri_array[2];
$uri_var_2    =    $uri_array[3];

$open = $page.'.php';

if (file_exists($open)) {
header("HTTP/1.1 200 OK");
include ($open);
} else {
header("HTTP/1.1 404 Not Found");
include ("404.php"); // Make a 404 page if the script can't find the required one
}

?>

Edit: Sorry, Didn't read your post fully, probably not what you need. Should help though.
 
Last edited:
0
•••
Thanks for the suggestion. Problem is still occuring though. I'm thinking the header needs to be placed in a different file?
 
0
•••
Simple thing would be to make a .htaccess

And then just code out the abcd-page.php to show the content.
 
0
•••
Hi Nick. Thanks for your suggestion. Are you referring to a modRewrite? if so, please can you explain further? Thanks.
 
0
•••
Yes I can tell you the exact code that you might need to put in the .htaccess file.

Please PM me or post here exactly what needs to be functioning.

So that I can write something related to it.

Thanks.

miseria said:
PHP:
<?php
header("HTTP/1.1 200 OK");

session_start();

$uri = $_SERVER['REQUEST_URI'];
$uri_array = explode("/",$uri);

function count_all($arg)
{
 // skip if argument is empty
 if ($arg) {
   // not an array, return 1 (base case)
   if(!is_array($arg))
   return 1;
   // else call recursively for all elements $arg
   foreach($arg as $key => $val)
   $count += count_all($val);
   return $count;
 }
}

$num = count_all($uri_array);


$page		=	$uri_array[1];
$uri_var_1	=	$uri_array[2];
$uri_var_2	=	$uri_array[3];

include $page.'.php';

?>
One more thing in the above code. Wouldn't the index of that array start at 0?

Anyway right now my mind is not working that fast.

I have found this. http://www.onlamp.com/pub/a/onlamp/2003/02/13/davidsklar.html

Maybe it will give you a better idea.
 
0
•••
Thanks for the link, it seems to use a similar method to the first article. So basically, I have a url which looks like this:

databases.php?c=website-content&d=free-website-content

and I want the following link to work instead:

databases/website-content/freewebsite-content.html

Any advice would be brilliant. Thanks
 
0
•••
Code:
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteRule databases/(.*)/(.*)\.html /datebases.php?c=$1&d=$2 [QSA,L]

Should get you started :)
 
0
•••
Thanks for the help Dan. I will certainly work with that when I get a free moment. NP$ sent.
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back