I'm changing my website's content platform from Drupal to a PHP custom made code.
In my current site I have two links that point to the same link like this:
Mainly because Drupal allows you to create a custom-made links, so every article has a default one (
node/123) and the custom-made one (
My question is about what to do in order to prevent losing any SEO that each link may have.
In the new website all articles are structured like this:
I've stored in the database the custom-made link of every article.
Instead of doing a 301 redirect I'm rewriting all links that do not exist to be redirected to redirect.php page to process the request. There I take the string from the link, look for it in the database and redirect the user.
The process is like this:
in .htaccess file:
RewriteRule ^.*$ ./redirect.php
I grab the
$_SERVER['REQUEST_URI'] and using explode() I get the last part of the link (ie. my-node-title), look for it in the database and grab the ID of the article (ie. 123) and save it in a
Then I use header() function and do the redirect:
So, people still click on
.../my-node-title but when the article loads at the navigation bar appears
I would like to know your comments about this solution. I know that with SEO there are not fixed rules, or certainty in anything, but I would like to know if what am I doing is acceptable. Thanks!