Drupal Development Blog is brought to you by Face 2 Interface, home of open source applications for your website.
Drupal Development Blog is brought to you by Face 2 Interface, home of open source applications for your website.
Now that I've put the content for my old site onto my new site it's time to implement the change in the most visitor and search engine friendly way possible.
A permanent header redirect would be good for search engines but I felt that it could confuse visitors, so I decided to use the HTTP meta-tag refresh method along with a conspicuous message explaining things.
Very easy to do in Drupal, because of the fact that Drupal uses a default theme which I can edit and also put PHP code into if needed.
Here's what I did - first added the meta-refresh in the document head of my default theme's page.tpl.php file, right after the title tag:
<meta http-equiv="refresh"
content="5;url=http://drupal.face2interface.com<?php print substr($_SERVER['REQUEST_URI'],10) ?>">
Then the message, put in a bright yellow background so as not to be missed and right on the top of the page. Below is the most important part of the text, if you'd like to see the rest do a view source on the site.
<h4>Click <a href="http://drupal.face2interface.com<?php print substr($_SERVER['REQUEST_URI'],10) ?>">here</a>
if you are not automatically taken to our new site</h4>
Notice the little bit of PHP code I used in these two snippets?
<?php print substr($_SERVER['REQUEST_URI'],10) ?>
REQUEST_URI is an environment variable which contains the path to the page not including the domain name.
I took the substring because the old site had an embedded path of "drupaldev/", 10 characters long, and that had to be dropped in order for the requested page on the old site to result in a proper URL on the new site.
Even with this effort, the mapping of old site page to new site page isn't working right. The reason is that the node numbers for the blog entries don't all match up. I could fix that pretty easily using the path module
administer >> site building >> url aliases
but I'm going to try keeping things simple here.