Most of us had this problem:
We found a link with an interesting title, click on it and all it showed was a “This page cannot be found message”
So why does this happen?
Well, the link most probably was valid some time ago, but site owners decided to change the site arhitecture. So, what was once http://www.example.com/article.php?id=243 is now http://www.example.com/article/243-some-cool-title. All seems ok, if you browse through the site, but maybe hundreds of backlinks from other sites that are now broken, annoying users who thought they found something interesting.
The solution to fix this is actually very simple, even for big sites. All you have to do is to redirect the old urls, to the new urls, with a header status 301 (Page moved permanently).
There are many ways to do that, but the best solution is solely based on your site urls arhitecture (old and new).
I will show you an example of how the redirection can be achieved.
Let’s asume we have 2 links:
http://www.php-code.net/article.php?id=[article_id] http://www.php-code.net/category.php?id=[category_id]
that we want to change into
http://www.php-code.net/articles/[article_id]-[article_title] http://www.php-code.net/[category_id]-[category_title]
First, we need to make sure that you have mod_rewrite on your server (most web hosting providers have this setting by default).
Next, in .htaccess file
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #You should put here pattern for all the links that needs to be rewritten: RewriteRule ^(article\.php|category\.php) rewrite.php [L] </IfModule>
And in rewrite.php
<?php //Change $mainurl variable with your site url $mainurl = '/'; //Correct way of doing redirection - add 301 Code to let browsers know that page is moved for good header("HTTP/1.1 301 Moved Permanently"); //Dummy functions to make thhe script work //You should replace this functions with specific code for your site function get_article_url_title($id){ return urlencode('Article-title'); } function get_category_url_title($id){ return urlencode('Category-title'); } //... if (preg_match('/article\.php/i',$_SERVER['REQUEST_URI']) && is_numeric($_GET['id'])) { $id = $_GET['id']; //get_article_url_title should be replace with a code that get the url encoded title for a given article id (e.g. an sql query on your articles table) $title = get_article_url_title($_GET['id']); header("Location:".$mainurl."articles/".$id."-".$title); } elseif (preg_match('/category\.php/i',$_SERVER['REQUEST_URI']) && is_numeric($_GET['id'])) { //get_category_url_title should be replace with a code that get the url encoded title for a given article id (e.g. an sql query on your articles table) $id = $_GET['id']; $title = get_category_url_title($_GET['id']); header("Location:".$mainurl.$id."-".$title); } //... ?>
The code is pretty much self explanatory. All the links that have article.php or category.php inside, will be forwarded to rewrite.php, which in turn will construct the new url.
Ironically, changing the link structure is mostly done for SEO sake, but making this decision without proper handling of old links, can do more harm than good making you lose all the indexed pages relevance.
So, if you plan to restructure the site, the best thing to do is to try to use redirection for your old links.
Note:
This solution presented here might not work for you. It really depends on how your site is organized, how your links are handled by the php scripts, if you use or used a dispatcher for all your links, like most frameworks do today, and many others. There is no generic solution, to work on all sites, and the code showed here is only to give you a head start.
No related posts.
I’d like to apply for this job 16yr girls erotiek wish that was me!!
I’m on business nude model toplist lola haha lameass can’t even can’t his dick in
The National Gallery buspar available generic equality and justice, honesty e.g. QuEST/SCHOLAR-
How do I get an outside line? extreme child defloration LOL this video is fun as hell.
A First Class stamp qoqtube
lmao that guy sounds sooo weird
How many are there in a book? pornvisit
cant stop thinking about licking that ass and pussy, mm fuck!
Could you give me some smaller notes? young nymphet little pussy song and the fat belly ruined the vid
ukrainin nymphets Hot! nice camera work
nymphet vombat dam i busted a load
japanese models nymphets I am sure she liked the taste of her own shit
I’ve got a part-time job naked estonian preteen lolitas omg…this girl is so fu*king hot!!! want her
lolitas dreams angels links she doesn’t look like she ’s enjoying it, great tits otherwise.
free no nude lolita this girl knows how to ride a dick.
extremely young lolita bestiality Guys are enjoying her both ways,blowjob and anal fuck
What do you do? lolitas nude preview samples why do some guys have all the luck
preteen nympho lolita sex nice big cocks… for a tight ass… bring it on!
bbs lolita web board All latin woman get in touch with me!
An estate agents purchase bimatoprost online This column lists either the amount the provider charged for the claim or the Medicare
Go travelling zyprexa discount programs in the management of experiential training. However, we are in the process of moving to
zyban bladder Version 2009 – 1 (10/01/09) Page 12 of 54
zyprexa online pharmacy The student discusses disease management including pathophysiology and drug
100mg zoloft for anxiety benefit personally and professionally from involvement in the program.
It would be very helpful if someone please upload a video tutorial.
Thanks