Don't leave behind .htaccess
When copying the files of a Drupal install, do not forget to copy Drupal's
.htaccess file. If you've had the vexing problem where a site you've just manipulated has clean URLs turned on but they suddenly don't work, this may well be the reason. It took me fixing this problem many times before I realized what was going on.
You make a directory for a new site,
cd to the new directory, and use
drush to download Drupal.
Now, you do an ls command and notice that drush put the files in a subdirectory of the current directory.
% ls -F
"No, problem," you think, you will just move those files up a level. So you
cd to the directory and copy the files up a level.
% cd drupal-6.20 % mv * ..
You think you copied all the files up a level, but the Unix wildcard "*" does not match
.htaccess so you left the
.htaccess file behind in the subdirectory. Your out-of-the box Drupal site is not going to work right without it (once you connect it properly to a blank database).
If you still do not believe that you left behind the
.htaccess do an
ls -a to check. You think there is nothing left in this directory but...
% ls -a
. .. .htaccess
The easiest thing is to recognize that it was left behind and do another command
% mv .htaccess ..
Then clean up with
% cd .. % rm -r drupal-6.20
Strange but true, the Unix wildcard "*" does not match hidden files, whose names begin with ".". But the file
>.htaccess is important to most Drupal installs, do not leave it behind when manipulating a site to switch hosting, or whatever. I'm pretty sure that there are other ways, with various file-handling GUIs to leave behind the hidden ".htaccess" fille. So, whatever tools you use to manipulate, move, or copy a site's files, just make sure that
.htaccess gets the same treatment as all the other files.