On http://drupal.org/upgrade/downloading-drupal-command-line, it says to copy .htaccess from the backup of the old site into your new site. The problem with this is that the newer version of Drupal may have introduced additional items in .htaccess that are also required. For example, 4.7 added tpl.php to the list of file types that are blocked (see http://drupal.org/node/58647). If you copy over the old .htaccess, you'll lose this bug fix.

Unfortunately, I don't think there's a simple way of dealing with this. The most reliable approach would be to compare your backup .htaccess to a pristine copy for the same version. If there are no differences, then just use the new version, and don't copy the one from the backup. If there are differences, then edit those differences into the new version. This approach assumes some expertise in .htaccess configuration.

A simpler approach might be to just copy the section from the old into the new, replacing the corresponding section in the new one. This assumes that the index.php?q syntax is here to stay, so that there won't be any changes to this part of .htaccess on the Drupal side of things. It also assumes there are no local changes to the rest of the file. This is based on the idea that commonly the only thing changed locally in .htaccess is the RewriteBase line, and that anyone who has changed any other part of the file knows what they're doing.

Perhaps someone can come up with a better solution, though I suspect .htaccess will be a pain forever.

CommentFileSizeAuthor
#3 UPGRADE.txt_1_0.patch868 bytespcwick
#2 UPGRADE.txt_0_0.patch1.48 KBpcwick

Comments

cog.rusty’s picture

As you said, someone who has modified .htaccess should know what they are doing. So, a short reminder should be safe enough. Something like:

"*** If your have made any required changes to your existing .htaccess file, remember to keep a note and add them to the new one."

pcwick’s picture

Title: Error in upgrade instructions with respect to copying over .htaccess » UPGRADE.txt Error with respect to copying over .htaccess
Project: Documentation » Drupal core
Version: » 5.x-dev
Component: Installation » base system
StatusFileSize
new1.48 KB

Changed from Documentation -> Drupal Project because similar patches have been posted there.

Changed Title for consistency with similar patches.

At first I thought it might be best to leave out any reminder about modified files such as .htaccess. However, I know of a case in which users will modify .htaccess without understanding what they are doing. Dreamhost provides instructions for making a simple cut and paste modification to .htaccess because "Drupal's initial settings can prevent access to your Dreamhost stats." http://wiki.dreamhost.com/index.php/Drupal#7._Edit_Your_.htaccess_File

I'm not sure that complicating UPGRADE.txt with a modified files reminder is justified. If so, the attached patch is one possible way to do so.

pcwick’s picture

StatusFileSize
new868 bytes

This alternative eliminates any reminders about modified files such as .htaccess

pcwick’s picture

Status: Active » Needs review
mfer’s picture

Status: Needs review » Needs work

To be consistent in this file and still remind those who have made changes it would be good to have a not pointing out that changes made to the .htaccess file and/or their robots.txt file need to be moved over to the new install.

mdupont’s picture

Status: Needs work » Closed (fixed)

Fixed in Drupal 6, where it reads

If other system files such as .htaccess or robots.txt were customized, re-create the modifications in the new versions of the files using the backups taken in step #1."