Clean URLs

well, i blew up my drupal install yesterday and had to drop my db, recreate it and reinstall. and that caused me to focus on something that i haven’t given enough attention to. clean urls. so now i am learning more about apache, .htaccess, apache2.conf, httpd.conf and the mod rewrite concepts. it feels like a step back but a good one in a way because i am having to learn some stuff about linux that i probably should know as an infrastructure guy. so we’ll see where it goes.

One thought on “Clean URLs”

  1. Procedure – Enable clean URLs for Drupal 7 on Ubuntu Desktop 12_04 rev_1.doc

    Date: 11/13/2012
    Author: PJ McGhee
    Email: PJMcGhee@hotmail.com

    Procedure: New 1
    Replace Existing 0

    Intended Audience: Drupal admins

    Purpose: To explain the steps needed to enable clean URLs in Drupal by enabling the rewrite_module component and changing the httpd.conf file of Apache2 to

    Web References:
    http://drupal.org/getting-started/clean-urls
    http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

    Procedure:

    1. Navigate to the Configuration, Search and Metadata section of Drupal.
    2. Click Clean URLs.
    3. In Drupal 7 the test will be run automatically and will give the result right away.
    4. When the test fails take a good look at the links above for background on the issue.
    5. Then, on this particular install, since you are running a dedicated server, you can do this first.
    6. At the command line, type apache2ctl –M and hit enter.
    7. Look for rewrite_module (shared) you should not see it (that’s to be expected)
    8. Type a2enmod rewrite and hit enter.
    9. Type apache2ctl –M again, hit enter. Now you should see the module listed there.
    10. Go to etcapache2 and edit the httpd.conf file which should be empty.
    11. Add the lines:

    RewriteEngine on
    RewriteBase /drupal
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    12. In this scenario, the directory structure shown is correct, but it should reflect where you actually have Drupal installed.
    13. Then type sudo /etc/init.d/force-reload and hit enter.
    14. Then type sudo /etc/init.d/apache2 restart and hit enter.
    15. Then test clean URLs in Drupal.
    16. You should now see a check box that will allow you to enable this feature.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: