A little of everything professional. This site contains the largest online collection of electronic signature laws and research, my views on Time Management & GTD life hacks for improving productivity, and my After Thoughts on bad decisions and business improvements. Personal thoughts and casual comments are pushed to my SEO project, The World's Greatest Guy.

Clean URL with Drupal websites

Clean URLs are very important for a variety of reasons. First off, clean URLs provide a neater/tighter presentation to visitor of your site.

  • Clean - www.example.com/clean
  • Not clean - www.example.com/clean.asp
  • Not clean - www.example.com/?q=clean

Clean URLs also provide easier searchability to Google and Yahoo's web crawling bots. Clean URLs also help to mask any future changes to your website, since you can change the extension (asp, html, php) and not receive broken links.

Drupal 4.7 has built-in clean URL functions making it relatively easy to convert your website one way or the other (go to admin/settings and then click "General Settings"). I must admit though that I did have some difficulty getting all of the pieces lined up the first time around. Here are a few of my notes.

Drupal comes with clean URLs turned off, so the best advise I can give to you to how to go back to the default setting just in case you can no longer surf your site. If this happens to you there are two solutions. 1) you can always navigate to the page you want by entering ?q=url_title where the clean URL should have been. This should allow you to get back to ?q=admin/settings and turn clean URLs off.

If this doesn't work you can also run a simple query on your MySQL database or edit your settings.php file.

MySQL
UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';
DELETE FROM cache;
or
settings.php
$conf['clean_url'] = 0;

You may also need to edit your .htaccess file in the root of the Drupal installation folder. I had to change the #RewriteBase /drupal to RewriteBase / in order to get clean URLs even though I was not installing Drupal into a sub-directory.


Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><p><b><i><blockquote>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Are you really a real person? Oh sure, like I can just trust you. Hey that's ASCII art! Cool.
          _                   _____                 
__ _ | | _ __ ___ |___ | __ _ __ _
/ _` | | | | '_ ` _ \ / / / _` | / _` |
| (_| | | |___ | | | | | | / / | (_| | | (_| |
\__, | |_____| |_| |_| |_| /_/ \__, | \__, |
|_| |_| |_|
Enter the code depicted in ASCII art style.