Information


Clean URLs in Drupal: Getting Them to Work

Although everything is fully explained on the Drupal site, getting clean URLs to work can be tricky. Actually, it is more a matter of confusion. If you are not confused, you will have no trouble. If you are confused, you may be missing something.

The first thing to understand is the Run the clean URL test. When you click this link, Drupal attempts to go to [your domain]/admin/settings/clean-urls, for example www.allergy-details.com/admin/settings/clean-urls. If you get a 404, then your system has failed the test, and you have to configure it to work. If you end up at the Clean URLs configuration page, then all is well, and you can enable clean URLs.

There is no actual path to …/admin/settings/clean-urls, so if the test generates a 404, don’t go looking for this missing file!

Note: The following applies only to Apache servers.

What you need to do is fix .htaccess. This is part of the Drupal installation, but it can sometimes go missing. In my case, I used FileZilla to move the extracted Drupal files down a directory to where they belong, the .htaccess file got left behind (because it starts with a dot, FileZilla can’t see it).

There are two ways to fix this problem. One is to use your server’s control panel to move the .htaccess file to where it belongs (in the root directory of your Drupal installation). The other option is to edit the existing .htaccess file, remove all contents, and replace it with the correct contents. If you unzip the .htaccess file from the Drupal .zip on your PC, you can copy the contents from there. Or you can copy them from this post (if you are viewing this post from the front page of my website, or from an archive, you will have to click the “read more” link to see the .htaccess file contents from this post).

Correct .htaccess Text for Drupal

Originally, I had the text for the .htaccess file pasted right here into the post.

I have removed it because I discovered that it may not always work. It may actually change with different versions.

I suggest that you copy the text right out of the zip file, but opening the zip, selecting .htaccess, and viewing it. Copy and paste that text into your server .htaccess file using the server-side file editing tool.


Comments

One comment:

Glad I found your guide, I was pulling my hair out for hours. turned out my problem was exactly like yours, my .htaccess file wasn’t migrated. All is well now!

THANKS!

Steve / February 2nd, 2007, 4:57 pm / #

Post a comment