Forum Moderators: phranque
RewriteRule ^([0-9]+)/([0-9]+)$ /index.php?section=$1&page=$2 [L] example.com/2345/123244 and fetch the content from /index.php?section=2345&page=123244 inside the server.
<?php
$section = $_REQUEST['section'];
$title = $_REQUEST['title'];
$page = $_REQUEST['page'];
?>
<a href="example.com/Blog/WebHosting/1">WebHosting Page 1</a>
and that would be "SEO suicide." Return proper "HTTP signalling" -- a 404 in this case, or kiss your search rankings goodbye... Returning any 200-OK response when a 404 is called for essentially makes the URL-space on your server infinite. And search engines do not respond well to that at all. They test for this flaw, and will arbitrarily limit the number of URLs they are willing to crawl on your site if they find that your server returns incorrect HTTP response codes.
Your script must return a proper 404 error response, and not redirect to anywhere.
Jim
Your script must return a proper 404 error response, and not redirect to anywhere.
If pattern does match but page not in the DB the script sends them to a default page.
On a static Website this would be the "home" page!
$req_uri = $_SERVER['REQUEST_URI'];in other words if someone navigated to the index.php page the variable $req_uri would be "/" so the script creates the "home" page which in the case of my Website could also be reached with the URL
example.com/main/WebHosting/1where "main" is parsed as the "section" and "Webhosting" is parsed as the "title" and "1" is parsed as the page number.
"if url matches pattern" but page doesn't exist in the databaseis simply if someone typed in example.com/main/web/1 the script will parse that and check the DB and find that "web" is not in the database as a title and the script will create the default page because the pattern did match but the content wasn't in the DB.
ErrorDocument 404 /error.htm
"SEO Suicide", Google actually recommends that you have a custom error page with a link back to the index page so that users aren't confronted with the default 404 error message that the server will output without a link back to the website!
If a user attempts to navigate by rewriting the query section of the URL!Now if it is true that robots might try to test a Website by putting in a query that doesn't exist than it will get the 404 error page just like anyone else and it can then navigate back through the proper link provided! Although I have reviewed my access logs a lot to design the analytic portion of my CMS ,I have never seen a robot (good or bad) create a false url to test my Website!
However, if someone types in a query that doesn't match the pattern i.e. example.com/main/WebHosting/somethingelse/1 the server redirects him to error.htm which has a link in it back to the index.php page.
When it comes to the section in the script to output the content section of the script in goes to the database and retrieves the data in the main table titled Webhosting with the page number of 1 and outputs it in the correct place.