Ubercart Quest: Clean URL for Drupal

Problem:

Product's images are not showing
One of the solutions or problem from the Ubercart's forum is Clean URLs is not enable.



Step 1: Clean URLs needs mod_rewrite to be enable
(Note: mod_rewrite is an Apache 2 module)

Type this command to see all the modules that is currently enable on Apache 2.

/usr/sbin/apache2ctl -M


Look for rewrite_module this is the mod_rewrite module that clean URL requires.

Step 2:
If mod_rewrite is not enable

To enable mod_rewrite module:

sudo /usr/sbin/a2enmod rewrite


You should get this after entering the command:


Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!



To disable the mod:

sudo /usr/sbin/a2dismod rewrite

You should get this after disabling the mod:

Module rewrite disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!
Remember to restart apache2:
sudo /etc/init.d/apache2 restart


Step 3: Check your apache2 config file
(I'm an apache2 noob so bare with me)

In the /etc/apache2/sites-enabled folder I've created a conf file that tells apache2 to host my drupal website.

Here's the general gist of what the config file, /etc/apache2/sistes-enabled/drupal.conf, have:



ServerName www.example.com
DocumentRoot /var/www/drupal-6.13

Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all



What you need to add:


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

So it should look like this:


ServerName www.example.com
DocumentRoot /var/www/drupal-6.13

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all




Remember to restart apache2:
sudo /etc/init.d/apache2 restart

Step 4: Enabling Clean URLS




System: Debian Lenny with Apache2

For information about mod_rewrite:
Apache module mod_rewrite

This post made possible by a mash of information from these websites:

0 comments:

Find It