Last updated August 30, 2009. Created by glass.dimly on August 25, 2009.
Log in to edit this page.
At times, after you've imported your content into the appropriate Drupal tables, you get a "page not found" error or just various weirdnesses. Sometimes Drupal needs a kick in the pants to register your imported nodes.
First, clear your caches. If that doesn't work, try clearing them again and running cron. Next, you may need some stronger medicine.
Loading your nodes programmatically and saving them using Drupal's built in functions allows your nodes to register themselves with the various contributed modules on your site and can resolve various issues.
I did this using a short script:
Caution: if you have Pathauto enabled with it's default settings, this will create new aliases for all your nodes based on their titles. If you don't want this, either disable pathauto before running, or change pathauto's settings to not automatically alias all saved nodes if they already have a URL alias.
<?php
/**this script can be copied to a file in the root of your drupal install
** and invoked by visiting yoursite.com/name_of_file.php
** This loads and then programmically saves all the nodes
** in you drupal installation.
** You must change the 'chdir' directory to your Drupal root.
**/
//change this to the root directory of your drupal installation:
chdir('/home/members/quixote/sites/d6');
include_once('./includes/bootstrap.inc');
include_once('./modules/node/node.pages.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
db_set_active('default');
$sql = "SELECT `nid` FROM node ORDER BY node.nid";
$results = db_query($sql);
$old_dump = array();
while( $nodes = db_fetch_object($results) ) {
print_r ($nodes->nid);
$currentnode = node_load( $nodes->nid );
print_r($currentnode);
node_save( $currentnode );
}
?>
Comments
Page not found- joomla relic?
I migrated a joomla site to drupal. I used node import to load nodes and simply copy pasted some text from the old site for some stable pages, like my About page. I'm getting some interesting page not found errors in my dblog. The page not found error gives a path from my old site, for example
templates/yougrids/images/metal/topmenu/hover_l.png
and
media/system/js/caption.js
I've cleared my cache, run cron, and used VBO to programatically publish all all of my nodes, which I believe should accomplish the same task as this script. Is this possibly being caused by outside links in to my site looking for the old joomla install? Or do I need to further "kick drupal in the pants" to get these errors to disappear? Is there a way to track a user's path to determine how they arrive at these page not found errors?
Or it could be your .htaccess if you're moving folders
This is probably only relevant if you're migrating (or testing an upgrade locally like me--oh, the troubles I get into for following best practices :P) and your new/test directory is different than what you're migrating from. For example, my live site is at the root (e.g. www.example.com) but my local is in a directory (localhost/drupal).
After looking through all of the posts that told me to clear my cache (it didn't help), I remembered about my .htaccess file...
Changing the line
RewriteBase /to
RewriteBase /drupalfixed everything.
I know this is an old post
I know this is an old post but need some help on this topic. I installed OpenPublish based on Drupal 6 locally using LAMP, then transferred everything over to my shared hosting by importing the database in phpmyadmin.
Everything seems to work fine except occasionally I get a 'page not found' error message, this seems to happen when accessing the database after uploading something etc.
I'm convinced that it has something to do with the database migration as I installed in localhost/openpublish and then transfered to the root of my shared hosting account.
Has anyone had this problem with occasional page not found errors and will the php fix outlined above work for my problem?